Safeguarding measures for a closed-loop insulin infusion system

ABSTRACT

Processor-implemented methods of controlling an insulin infusion device for a user are provided here. A first method obtains a current insulin on board (IOB) value that estimates active insulin in the user, and compensates a calculated insulin infusion rate in response to the obtained IOB value. A second method supervises the operation of a glucose sensor by obtaining and processing insulin-delivered data and glucose sensor data for the user. An alert is generated if the second method determines that a current glucose sensor value has deviated from a predicted sensor glucose value by at least a threshold amount.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a divisional of U.S. patent application Ser. No.13/870,910, filed Apr. 25, 2013, which claims the benefit of thefollowing: U.S. provisional patent application No. 61/694,950, filedAug. 30, 2012 (titled “Closed Loop System”); U.S. provisional patentapplication No. 61/694,961, filed Aug. 30, 2012 (titled “Closed LoopMobile System”); and U.S. provisional patent application No. 61/812,874,filed Apr. 17, 2013 (titled “Closed Loop System”).

TECHNICAL FIELD

Embodiments of the subject matter described herein relate generally todrug delivery systems and more specifically to systems for controllingthe infusion rate of insulin based on state variable feedback.

BACKGROUND

The pancreas of a normal healthy person produces and releases insulininto the blood stream in response to elevated blood plasma glucoselevels. Beta cells (β-cells), which reside in the pancreas, produce andsecrete the insulin into the blood stream, as it is needed. If β-cellsbecome incapacitated or die, a condition known as Type I diabetesmellitus (or in some cases if β-cells produce insufficient quantities ofinsulin, Type II diabetes), then insulin must be provided to the bodyfrom another source.

Traditionally, since insulin cannot be taken orally, insulin has beeninjected with a syringe. More recently, use of infusion pump therapy hasbeen increasing, especially for delivering insulin for diabetics. Forexample, external infusion pumps are worn on a belt, in a pocket, or thelike, and deliver insulin into the body via an infusion tube with apercutaneous needle or a cannula placed in the subcutaneous tissue. Asof 1995, less than 5% of Type I diabetics in the United States wereusing infusion pump therapy. Presently, over 7% of the more than 900,000Type I diabetics in the United States are using infusion pump therapy,and the percentage of Type I diabetics that use an infusion pump isgrowing at an absolute rate of over 2% each year. Moreover, the numberof Type I diabetics is growing at 3% or more per year. In addition,growing numbers of insulin-using Type II diabetics are also usinginfusion pumps. Physicians have recognized that continuous infusionprovides greater control of a diabetic's condition, and are alsoincreasingly prescribing it for patients. Although offering control,pump therapy can suffer from several complications that make use oftraditional external infusion pumps less desirable for the user.

In insulin pumps, it is common to use fast acting insulin as opposed tothe slower acting insulin that is used for injections, because pumpsallow changing of insulin profiles. As insulin companies develop fasteracting insulin, the faster acting insulin is often adopted quickly.However, current pumps are still limited by the speed of the insulinthey are using.

BRIEF SUMMARY

A processor-implemented method is presented here. The method can be usedto control an insulin infusion device for a user. Certain embodiments ofthe method involve the operation of a processor architecture having atleast one processor device to obtain a current insulin on board (JOB)value that represents an estimate of active insulin in the body of theuser. The method continues by calculating, by the processorarchitecture, an IOB rate based at least in part on the obtained currentIOB value. The method continues by determining, by the processorarchitecture, an adjusted insulin infusion rate based at least in parton the calculated IOB rate and an uncompensated insulin infusion rate.The processor architecture selects a final insulin infusion rate for theinsulin infusion device, wherein either the determined adjusted insulininfusion rate, the uncompensated insulin infusion rate, or a currentbasal rate is selected as the final insulin infusion rate.

Also presented here is a processor-implemented method of controlling aninsulin infusion device for a user. Certain embodiments of the methodbegin by generating a current IOB value that represents an estimate ofactive insulin in the body of the user. The method continues bycalculating an IOB rate based at least in part on the generated currentIOB value, obtaining an uncompensated insulin infusion rate, anddetermining an adjusted insulin infusion rate in accordance with theexpression AdjustedRate(n)=max(0; PIDRate(n)−IOBRate(n)). The methodcontinues by selecting a final insulin infusion rate in accordance withthe expression

${{FinalRate}(n)} = \{ {\begin{matrix}{{\max( {{Basal};{{AdjustedRate}(n)}} )},} & {{PIDRate} > {Basal}} \\{{{PIDRate}(n)},} & {{PIDRate} \leq {Basal}}\end{matrix}.} $In this expression: AdjustedRate(n) is the determined adjusted insulininfusion rate; PIDRate(n) is the obtained uncompensated insulin infusionrate; IOBRate(n) is the calculated IOB rate; FinalRate(n) is theselected final insulin infusion rate; and Basal is a current basal ratemaintained by the insulin infusion device for the user.

Also presented here is a tangible and non-transitory electronic storagemedium having processor-executable instructions that, when executed by aprocessor architecture comprising at least one processor device, performa method of controlling an insulin infusion device for a user. Incertain embodiments, the method begins by estimating a current IOB valuethat indicates an amount of active insulin in the body of the user. Themethod continues by calculating an IOB rate based at least in part onthe estimated current IOB value, determining an adjusted insulininfusion rate based at least in part on the calculated IOB rate and anuncompensated insulin infusion rate, and selecting a final insulininfusion rate for the insulin infusion device, wherein either thedetermined adjusted insulin infusion rate, the uncompensated insulininfusion rate, or a current basal rate is selected as the final insulininfusion rate. The method then provides the selected final insulininfusion rate to regulate delivery of insulin by the insulin infusiondevice.

An electronic device is also presented here. Certain embodiments of theelectronic device include a processor architecture and at least onememory element associated with the processor architecture. The at leastone memory element stores processor-executable instructions that, whenexecuted by the processor architecture, perform a method of controllingan insulin infusion device for a user. The method involves: computing acurrent IOB value that indicates an amount of active insulin in the bodyof the user; calculating an IOB rate based at least in part on thecomputed IOB value; determining an adjusted insulin infusion rate basedat least in part on the calculated IOB rate and an uncompensated insulininfusion rate; and selecting a final insulin infusion rate for theinsulin infusion device. The selecting step selects either thedetermined adjusted insulin infusion rate, the uncompensated insulininfusion rate, or a current basal rate as the final insulin infusionrate.

An electronic controller for an insulin infusion device is alsopresented here. The electronic controller includes a processorarchitecture comprising at least one processor device, and at least onememory element associated with the processor architecture. The at leastone memory element stores processor-executable instructions that, whenexecuted by the processor architecture, provide an IOB compensationmodule that estimates a current IOB value that indicates an amount ofactive insulin in the body of the user, calculates an IOB rate based atleast in part on the estimated current IOB value, and determines anadjusted insulin infusion rate based at least in part on the calculatedIOB rate and an uncompensated insulin infusion rate. The IOBcompensation module selects a final insulin infusion rate for theinsulin infusion device, wherein the final insulin infusion rate isselected as either the determined adjusted insulin infusion rate, theuncompensated insulin infusion rate, or a current basal rate. The IOBcompensation module then provides the selected final insulin infusionrate to regulate delivery of insulin by the insulin infusion device.

An exemplary embodiment of an electronic device is also provided here.The electronic device includes a processor architecture having at leastone processor device, and at least one memory element associated withthe processor architecture. The at least one memory element storesprocessor-executable instructions that, when executed by the processorarchitecture, perform a method of controlling an insulin infusion devicefor a user. The method operates the insulin infusion device in aclosed-loop mode to deliver insulin to the body of the user, obtainscurrent insulin-delivered data that indicates an amount of insulindelivered by the insulin infusion device during a most recent samplingperiod, obtains current sensor data that indicates a current sensorglucose value for the user corresponding to the most recent samplingperiod, and processes historical insulin-delivered data and historicalsensor data, for a plurality of historical sampling periods prior to themost recent sampling period, to obtain predicted sensor glucose valuesfor a historical time period. The method continues by calculating adifference between the current sensor glucose value and a predictedcurrent sensor glucose value for the most recent sampling period,wherein the predicted sensor glucose values for the historical timeperiod include the predicted current sensor glucose value. The methodcontinues by generating an alert when the difference exceeds a thresholderror amount.

The following detailed description also relates to a tangible andnon-transitory electronic storage medium having processor executableinstructions that, when executed by a processor architecture comprisingat least one processor device, perform a method of controlling aninsulin infusion device for a user. The method involves operation of theinsulin infusion device in a closed-loop mode to deliver insulin to thebody of the user. The method continues by identifying, from historicalsensor glucose values for the user, a baseline historical sensor glucosevalue obtained during a begin-training sampling period. The methodcalculates a plurality of candidate solutions to a sensor glucoseprediction model, wherein each of the plurality of candidate solutionsis calculated as a function of a bounded initial condition andhistorical insulin delivered data for the user, and wherein the boundedinitial condition is influenced by the baseline sensor glucose value.The method continues by selecting a best-matched solution from thecalculated plurality of candidate solutions, based on a comparison ofpredicted sensor glucose values from the calculated plurality ofcandidate solutions to a first portion of the historical sensor glucosevalues. The predicted sensor glucose values from the best-matchedsolution are compared to a second portion of the historical sensorglucose values, wherein the first portion of the historical sensorglucose values corresponds to a distant history period, the secondportion of the historical sensor glucose values corresponds to a recenthistory period, and the distant history period occurred before therecent history period that data samples. The method continues bygenerating an alert, in response to the comparing, when the secondportion of the historical sensor glucose values deviates from thebest-matched solution by at least a threshold error amount.

Also presented here is an embodiment of an electronic controller for aninsulin infusion device. The electronic controller includes a processorarchitecture comprising at least one processor device, and at least onememory element associated with the processor architecture. The at leastone memory element stores processor-executable instructions that, whenexecuted by the processor architecture, provide a model supervisormodule to obtain, during closed-loop operation of the insulin infusiondevice, insulin-delivered data that indicates an amount of insulindelivered by the insulin infusion device during a most recent samplingperiod, and current sensor data that indicates a current sensor glucosevalue for the user corresponding to the most recent sampling period. Themodel supervisor module defines a model training period and a modelprediction period for a historical period of time, and finds abest-matched solution to a sensor glucose prediction model, relative tohistorical sensor glucose values obtained during the model trainingperiod, wherein the best-matched solution is a function of a baselinesensor glucose value obtained during the model training period, and is afunction of historical insulin-delivered data for the user obtainedduring the historical period of time. The model supervisor modulecompares at least one predicted sensor glucose value from thebest-matched solution to at least one historical sensor glucose valuecorresponding only to the model prediction period, and generates analert, in response to the comparing, when the at least one historicalsensor glucose value deviates from the at least one predicted sensorglucose value by at least a threshold error amount.

Also included below is a detailed description of a processor-implementedmethod of controlling an insulin infusion device for a user. The methodmay begin by operating the insulin infusion device in a closed-loop modeto deliver insulin to the body of the user. The method continues byobtaining current insulin-delivered data that indicates an amount ofinsulin delivered by the insulin infusion device during a most recentsampling period, obtaining current sensor data that indicates a currentsensor glucose value for the user corresponding to the most recentsampling period, and processing historical insulin-delivered data andhistorical sensor data, for a plurality of historical sampling periodsprior to the most recent sampling period, to obtain predicted sensorglucose values for a historical time period. The method then calculatesa difference between the current sensor glucose value and a predictedcurrent sensor glucose value for the most recent sampling period,wherein the predicted sensor glucose values for the historical timeperiod include the predicted current sensor glucose value. An alert isgenerated when the difference exceeds a threshold error amount.

Also included below is a detailed description of a processor-implementedmethod of controlling an insulin infusion device for a user. The methodmay begin by operating the insulin infusion device in a closed-loop modeto deliver insulin to the body of the user. The method continues byidentifying, from historical sensor glucose values for the user, abaseline historical sensor glucose value obtained during abegin-training sampling period. Next, a plurality of candidate solutionsto a sensor glucose prediction model is calculated, wherein each of theplurality of candidate solutions is calculated as a function of abounded initial condition and historical insulin delivered data for theuser, and wherein the bounded initial condition is influenced by thebaseline sensor glucose value. The method continues by selecting abest-matched solution from the calculated plurality of candidatesolutions, based on a comparison of predicted sensor glucose values fromthe calculated plurality of candidate solutions to a first portion ofthe historical sensor glucose values. At least one predicted sensorglucose value from the best-matched solution is compared to a secondportion of the historical sensor glucose values, wherein the firstportion of the historical sensor glucose values corresponds to a distanthistory period, the second portion of the historical sensor glucosevalues corresponds to a recent history period, and the distant historyperiod occurred before the recent history period that data samples. Analert is generated, in response to the comparing, when the secondportion of the historical sensor glucose values deviates from thebest-matched solution by at least a threshold error amount.

Another embodiment of a processor-implemented method of controlling aninsulin infusion device for a user is also presented below. The methodinvolves operating the insulin infusion device in a closed-loop mode todeliver insulin to the body of the user, defining a model trainingperiod and a model prediction period for a historical period of time,and finding a best-matched solution to a sensor glucose predictionmodel, relative to historical sensor glucose values obtained during themodel training period, wherein the best-matched solution is a functionof a baseline sensor glucose value obtained during the model trainingperiod, and is a function of historical insulin-delivered data for theuser obtained during the historical period of time. The method continuesby comparing at least one predicted sensor glucose value from thebest-matched solution to at least one historical sensor glucose valuecorresponding only to the model prediction period. An alert isgenerated, in response to the comparing, when the at least onehistorical sensor glucose value deviates from the at least one predictedsensor glucose value by at least a threshold error amount.

This summary is provided to introduce a selection of concepts in asimplified form that are further described below in the detaileddescription. This summary is not intended to identify key features oressential features of the claimed subject matter, nor is it intended tobe used as an aid in determining the scope of the claimed subjectmatter.

BRIEF DESCRIPTION OF THE DRAWINGS

A more complete understanding of the subject matter may be derived byreferring to the detailed description and claims when considered inconjunction with the following figures, wherein like reference numbersrefer to similar elements throughout the figures.

FIG. 1 is a block diagram of a closed loop glucose control system inaccordance with an embodiment of the present invention.

FIG. 2 is a front view of closed loop hardware located on a body inaccordance with an embodiment of the present invention.

FIG. 3A is a perspective view of a glucose sensor system for use in anembodiment of the present invention.

FIG. 3B is a side cross-sectional view of the glucose sensor system ofFIG. 3A.

FIG. 3C is a perspective view of a sensor set of the glucose sensorsystem of FIG. 3A for use in an embodiment of the present invention.

FIG. 3D is a side cross-sectional view of the sensor set of FIG. 3C.

FIG. 4 is a cross sectional view of a sensing end of the sensor of FIG.3D.

FIG. 5 is a top view of an infusion device with a reservoir door in theopen position, for use in an embodiment of the present invention.

FIG. 6 is a side view of an infusion set with the insertion needlepulled out, for use in an embodiment of the present invention.

FIG. 7 is a circuit diagram of a sensor and its power supply inaccordance with an embodiment of the present invention.

FIG. 8A is a diagram of a single device and its components in accordancewith an embodiment of the present invention.

FIG. 8B is a diagram of two devices and their components in accordancewith an embodiment of the present invention.

FIG. 8C is another diagram of two devices and their components inaccordance with an embodiment of the present invention.

FIG. 8D is a diagram of three devices and their components in accordancewith an embodiment of the present invention.

FIG. 9 is a table listing the devices of FIGS. 8A-D and theircomponents.

FIG. 10 is a block diagram of the glucose sensor system of FIG. 3A.

FIG. 11A is a detailed block diagram of an A/D converter for the glucosesensor system of FIG. 10 in accordance with an embodiment of the presentinvention.

FIG. 11B is a detailed block diagram of the A/D converter for theglucose sensor system of FIG. 10 with a pulse duration output selectionoption in accordance with an embodiment of the present invention.

FIG. 12 is a circuit diagram of an I-F A/D converter of FIG. 10accompanied by charts of node signals in accordance with an embodimentof the present invention.

FIG. 13 is another circuit diagram of an I-F A/D converter of FIG. 10accompanied by charts of node signals in accordance with an embodimentof the present invention.

FIG. 14 is still another circuit diagram of an I-F A/D converter of FIG.10 accompanied by charts of node signals in accordance with anembodiment of the present invention.

FIG. 15 is a circuit diagram of an I-V A/D converter of FIG. 10 inaccordance with an embodiment of the present invention.

FIG. 16 is a block diagram of the glucose sensor system of FIG. 10 witha pre-filter and a filter in accordance with an embodiment of thepresent invention.

FIG. 17 is a chart of an example of a pre-filter of FIG. 16 and itseffects on digital sensor values Dsig in accordance with an embodimentof the present invention.

FIG. 18 is frequency response chart for a filter of FIG. 16 inaccordance with an embodiment of the present invention.

FIG. 19A is a plot of a filtered and an unfiltered sensor signal overtime in accordance with an embodiment of the present invention.

FIG. 19B is close up of a section of the plot of FIG. 19A in accordancewith an embodiment of the present invention.

FIG. 20 is a cross-sectional view of a sensor set and an infusion setattached to the body in accordance with an embodiment of the presentinvention.

FIG. 21 is a frequency response chart of a time delay correcting Weinerfilter in accordance with an embodiment of the present invention.

FIG. 22 is a plot of a digital sensor values Dsig before and after timedelay correction compared to actual glucose measurements over time inaccordance with an embodiment of the present invention.

FIG. 23A is a diagram of a glucose clamp (glucose level with respect totime).

FIG. 23B is a plot of insulin concentration in a normal glucose tolerant(NGT) individual in response to various magnitudes of glucose clamps ofFIG. 23A.

FIG. 24A is a diagram of a glucose clamp.

FIG. 24B is a diagram of a proportional insulin response to the glucoseclamp of FIG. 24A in accordance with an embodiment of the presentinvention.

FIG. 24C is a diagram of an integral insulin response to the glucoseclamp of FIG. 24A in accordance with an embodiment of the presentinvention.

FIG. 24D is a diagram of a derivative insulin response to the glucoseclamp of FIG. 24A in accordance with an embodiment of the presentinvention.

FIG. 24E is a diagram of a combined proportional, integral, andderivative insulin response to the glucose clamp of FIG. 24A inaccordance with an embodiment of the present invention.

FIG. 25A is a plot of insulin responses to a glucose clamp for exercisetrained and normal individuals.

FIG. 25B is a bar chart of glucose uptake rates for exercise trained andnormal individuals.

FIG. 26 is a block diagram of a closed loop system to control bloodglucose levels through insulin infusion based on glucose level feedbackin accordance with an embodiment of the present invention.

FIG. 27 is a detailed block diagram of the portion of the control loopof FIG. 26 that is in the body in accordance with an embodiment of thepresent invention.

FIGS. 28A and 28B are plots of measured insulin responses of twodifferent normal glucose tolerant (NGT) individuals to a glucose clampfor use with an embodiment of the present invention.

FIG. 29A is a plot of two different glucose sensor outputs compared toglucose meter readings during a glucose clamp in accordance with anembodiment of the present invention.

FIG. 29B is a plot of actual insulin concentration in blood compared toa controller commanded insulin concentration in response to the glucoseclamp of FIG. 29A in accordance with an embodiment of the presentinvention.

FIG. 30 is a top view of an end of a multi-sensor for measuring bothglucose concentration and pH in accordance with an embodiment of thepresent invention.

FIG. 31A is a representative drawing of blood glucose compared to sensormeasured blood glucose over time in accordance with an embodiment of thepresent invention.

FIG. 31B is a representative drawing of sensor sensitivity over the sameperiod of time as FIG. 31A in accordance with an embodiment of thepresent invention.

FIG. 31C is a representative drawing of sensor resistance over the sameperiod of time as FIG. 31A in accordance with an embodiment of thepresent invention.

FIG. 32 is a block diagram using the derivative of sensor resistance todetermine when to recalibrate or replace the sensor in accordance withan embodiment of the present invention.

FIG. 33A is a plot of an analog sensor signal Isig over time inaccordance with an embodiment of the present invention.

FIG. 33B is a plot of sensor resistance over the same period of time asFIG. 32A in accordance with an embodiment of the present invention.

FIG. 33C is a plot of the derivative of the sensor resistance of FIG.32B in accordance with an embodiment of the present invention.

FIG. 34A is a bottom view of a telemetered characteristic monitor inaccordance with an embodiment of the present invention.

FIG. 34B is a bottom view of a different telemetered characteristicmonitor in accordance with an embodiment of the present invention.

FIG. 35A is a drawing of a blood plasma insulin response to a glucoseclamp in a normal glucose tolerant (NGT) individual in accordance withan embodiment of the present invention.

FIG. 35B is a drawing of the blood plasma insulin response of FIG. 35Awhen delayed due to insulin being delivered to the subcutaneous tissueinstead of directly into the blood stream in accordance with anembodiment of the present invention.

FIG. 36A is a drawing of blood plasma insulin concentration over timeafter an insulin bolus is delivered directly into the blood stream inaccordance with an embodiment of the present invention.

FIG. 36B is a drawing of a blood plasma insulin concentration over timeafter an insulin bolus is delivered into the subcutaneous tissue inaccordance with an embodiment of the present invention.

FIG. 37 is a block diagram of the closed loop system of FIG. 26 with theaddition of a post-controller compensator and a derivative filter inaccordance with an embodiment of the present invention.

FIG. 38 depicts plots of measurements and calculations related to sensorresistance.

FIGS. 39A and 39B are a block diagrams of a closed loop glucose controlsystem in accordance with embodiments of the present invention.

FIG. 40 is a block diagram of auto blood withdrawal and return inaccordance with an embodiment of the present invention.

FIG. 41A is a plot actual blood glucose concentration in accordance withan embodiment of the present invention.

FIG. 41B is a plot of actual insulin concentration in blood compared toa controller commanded insulin concentration in response to the bloodglucose in FIG. 41A in accordance with an embodiment of the presentinvention.

FIG. 42 illustrates a control feedback block diagram of state variablefeedback and in accordance with an embodiment of the present invention.

FIG. 43 is a plot of basal insulin delivery rate over time usingdifferent control gains in accordance with embodiments of the presentinvention.

FIG. 44 is a plot of subcutaneous insulin over time using differentcontrol gains in accordance with embodiments of the present invention.

FIG. 45 is a plot of plasma insulin over time using different controlgains in accordance with embodiments of the present invention.

FIG. 46 is a plot of insulin effect over time using different controlgains in accordance with embodiments of the present invention.

FIG. 47 is a plot of simulated glucose concentration over time using aPID controller with state variable feedback and a PID controller withoutstate variable feedback in accordance with embodiments of the presentinvention.

FIG. 48 is a plot of simulated insulin delivery over time using a PIDcontroller with state variable feedback and a PID controller withoutstate variable feedback in accordance with embodiments of the presentinvention.

FIG. 49 is a block diagram that illustrates processing modules andalgorithms of an exemplary embodiment of a closed-loop systemcontroller.

FIG. 50 is a flow chart that illustrates an exemplary embodiment of acontrol process for an insulin infusion device.

FIG. 51 is a graph of integral clip value versus sensor glucose levels.

FIG. 52 is a block diagram that schematically illustrates an exemplaryembodiment of an insulin on board (JOB) compensation module.

FIG. 53 is a flow chart that illustrates an exemplary embodiment of anIOB compensation process.

FIG. 54 is a diagram that depicts certain time events associated withthe operation of a model supervisor module.

FIG. 55 is a flow chart that illustrates an exemplary embodiment of asensor model supervision process.

FIG. 56 is a flow chart that illustrates an exemplary embodiment of asensor model training process, which may be performed in conjunctionwith the sensor model supervision process depicted in FIG. 55.

FIG. 57 is a diagram that illustrates two exemplary fault conditionsthat can be detected by the model supervisor module.

DETAILED DESCRIPTION

The following detailed description is merely illustrative in nature andis not intended to limit the embodiments of the subject matter or theapplication and uses of such embodiments. As used herein, the word“exemplary” means “serving as an example, instance, or illustration.”Any implementation described herein as exemplary is not necessarily tobe construed as preferred or advantageous over other implementations.Furthermore, there is no intention to be bound by any expressed orimplied theory presented in the preceding technical field, background,brief summary or the following detailed description.

Techniques and technologies may be described herein in terms offunctional and/or logical block components, and with reference tosymbolic representations of operations, processing tasks, and functionsthat may be performed by various computing components or devices. Suchoperations, tasks, and functions are sometimes referred to as beingcomputer-executed, computerized, software-implemented, orcomputer-implemented. It should be appreciated that the various blockcomponents shown in the figures may be realized by any number ofhardware, software, and/or firmware components configured to perform thespecified functions. For example, an embodiment of a system or acomponent may employ various integrated circuit components, e.g., memoryelements, digital signal processing elements, logic elements, look-uptables, or the like, which may carry out a variety of functions underthe control of one or more microprocessors or other control devices.

When implemented in software or firmware, various elements of thesystems described herein are essentially the code segments orinstructions that perform the various tasks. The program or codesegments can be stored in any tangible and non-transitoryprocessor-readable medium. The “processor-readable medium” or“machine-readable medium” may include any medium that can store ortransfer information. Examples of the processor-readable medium includean electronic circuit, a semiconductor memory device, a ROM, a flashmemory, an erasable ROM (EROM), a floppy diskette, a CD-ROM, an opticaldisk, a hard disk, or the like.

The various tasks performed in connection with a process describedherein may be performed by software, hardware, firmware, or anycombination thereof. It should be appreciated that a described processmay include any number of additional or alternative tasks, the tasksshown in a particular figure need not be performed in the illustratedorder, and a described process may be incorporated into a morecomprehensive procedure or process having additional functionality notdescribed in detail herein. Moreover, one or more of the tasks shown inthe figures could be omitted from an embodiment of a described processas long as the intended overall functionality remains intact.

As shown in the drawings for purposes of illustration, the invention isembodied in a closed loop infusion system for regulating the rate offluid infusion into a body of a user based on feedback from an analyteconcentration measurement taken from the body. In particularembodiments, the invention is embodied in a control system forregulating the rate of insulin infusion into the body of a user based ona glucose concentration measurement taken from the body. In preferredembodiments, the system is designed to model a pancreatic beta cell(β-cell). In other words, the system controls an infusion device torelease insulin into a body of a user in a similar concentration profileas would be created by fully functioning human β-cells when respondingto changes in blood glucose concentrations in the body.

Thus, the system simulates the body's natural insulin response to bloodglucose levels and not only makes efficient use of insulin, but alsoaccounts for other bodily functions as well since insulin has bothmetabolic and mitogenic effects. However, the algorithms must model theβ-cells closely, since algorithms that are designed to minimize glucoseexcursions in the body, without regard for how much insulin isdelivered, may cause excessive weight gain, hypertension, andatherosclerosis. In preferred embodiments of the present invention, thesystem is intended to emulate the in vivo insulin secretion pattern andto adjust this pattern consistent with the in vivo β-cell adaptationexperienced by normal healthy individuals. The in vivo β-cell responsein subjects with normal glucose tolerance (NGT), with widely varyinginsulin sensitivity (S_(I)), is the optimal insulin response for themaintenance of glucose homeostasis.

Preferred embodiments include a glucose sensor system 10, a controller12 and an insulin delivery system 14, as shown in FIG. 1. The glucosesensor system 10 generates a sensor signal 16 representative of bloodglucose levels 18 in the body 20, and provides the sensor signal 16 tothe controller 12. The controller 12 receives the sensor signal 16 andgenerates commands 22 that are communicated to the insulin deliverysystem 14. The insulin delivery system 14 receives the commands 22 andinfuses insulin 24 into the body 20 in response to the commands 22.

Generally, the glucose sensor system 10 includes a glucose sensor,sensor electrical components to provide power to the sensor and generatethe sensor signal 16, a sensor communication system to carry the sensorsignal 16 to the controller 12, and a sensor system housing for theelectrical components and the sensor communication system.

Typically, the controller 12 includes controller electrical componentsand software to generate commands for the insulin delivery system 14based on the sensor signal 16, and a controller communication system toreceive the sensor signal 16 and carry commands to the insulin deliverysystem 14.

Generally, the insulin delivery system 14 includes an infusion deviceand an infusion tube to infuse insulin 24 into the body 20. Inparticular embodiments, the infusion device includes infusion electricalcomponents to activate an infusion motor according to the commands 22,an infusion communication system to receive the commands 22 from thecontroller 12, and an infusion device housing to hold the infusiondevice.

In preferred embodiments, the controller 12 is housed in the infusiondevice housing and the infusion communication system is an electricaltrace or a wire that carries the commands 22 from the controller 12 tothe infusion device. In alternative embodiments, the controller 12 ishoused in the sensor system housing and the sensor communication systemis an electrical trace or a wire that carries the sensor signal 16 fromthe sensor electrical components to the controller electricalcomponents. In other alternative embodiments, the controller 12 has itsown housing or is included in a supplemental device. In anotheralternative embodiment, the controller is located with the infusiondevice and the sensor system all within one housing. In furtheralternative embodiments, the sensor, controller, and/or infusioncommunication systems may utilize a cable, a wire, fiber optic lines,RF, IR, or ultrasonic transmitters and receivers, or the like instead ofthe electrical traces.

System Overview

Preferred embodiments of the invention include a sensor 26, a sensor set28, a telemetered characteristic monitor 30, a sensor cable 32, aninfusion device 34, an infusion tube 36, and an infusion set 38, allworn on the body 20 of a user, as shown in FIG. 2. The telemeteredcharacteristic monitor 30 includes a monitor housing 31 that supports aprinted circuit board 33, batteries 35, antenna (not shown), and asensor cable connector (not shown), as seen in FIGS. 3A and 3B. Asensing end 40 of the sensor 26 has exposed electrodes 42 and isinserted through skin 46 into a subcutaneous tissue 44 of a user's body20, as shown in FIGS. 3D and 4. The electrodes 42 are in contact withinterstitial fluid (ISF) that is present throughout the subcutaneoustissue 44. The sensor 26 is held in place by the sensor set 28, which isadhesively secured to the user's skin 46, as shown in FIGS. 3C and 3D.The sensor set 28 provides for a connector end 27 of the sensor 26 toconnect to a first end 29 of the sensor cable 32. A second end 37 of thesensor cable 32 connects to the monitor housing 31. The batteries 35included in the monitor housing 31 provide power for the sensor 26 andelectrical components 39 on the printed circuit board 33. The electricalcomponents 39 sample the sensor signal 16 and store digital sensorvalues (Dsig) in a memory and then periodically transmit the digitalsensor values Dsig from the memory to the controller 12, which isincluded in the infusion device.

The controller 12 processes the digital sensor values Dsig and generatescommands 22 for the infusion device 34. Preferably, the infusion device34 responds to the commands 22 and actuates a plunger 48 that forcesinsulin 24 out of a reservoir 50 located inside the infusion device 34,as shown in FIG. 5. In particular embodiments, a connector tip 54 of thereservoir 50 extends through the infusion device housing 52 and a firstend 51 of the infusion tube 36 is attached to the connector tip 54. Asecond end 53 of the infusion tube 36 connects to the infusion set 38.Insulin 24 is forced through the infusion tube 36 into the infusion set38 and into the body 20. The infusion set 38 is adhesively attached tothe user's skin 46, as shown in FIG. 6. As part of the infusion set 38,a cannula 56 extends through the skin 46 and terminates in thesubcutaneous tissue 44 completing fluid communication between thereservoir 50 and the subcutaneous tissue 44 of the user's body 20.

In alternative embodiments, the closed-loop system can be a part of ahospital-based glucose management system. Given that insulin therapyduring intensive care has been shown to dramatically improve woundhealing, reduce blood stream infections, renal failure, andpolyneuropathy mortality, irrespective of whether subjects previouslyhad diabetes (See Van den Berghe G. et al., NEJM 345: 1359-67, 2001,which is incorporated by reference herein), the present invention can beused in this hospital setting to control the blood glucose level of apatient in intensive care. In these alternative embodiments, since anintravenous (IV) hookup is typically implanted into a patient's armwhile the patient is in an intensive care setting (e.g., ICU), a closedloop glucose control can be established which piggy-backs off theexisting IV connection. Thus, in a hospital based system, IV catheterswhich are directly connected to a patient vascular system for purposesof quickly delivering IV fluids, can also be used to facilitate bloodsampling and direct infusion of substances (e.g., insulin,anticoagulants) into the intra-vascular space. Moreover, glucose sensorsmay be inserted through the IV line to give real-time glucose levelsfrom the blood stream. Therefore, depending on the type of hospitalbased system, the alternative embodiments would not necessarily need thedescribed system components such as the sensor 26, the sensor set 28,the telemetered characteristic monitor 30, the sensor cable 32, theinfusion tube 36, and the infusion set 38 as described in the preferredembodiments. Instead, standard blood glucose meters or vascular glucosesensors as described in provisional application entitled “Multi-lumenCatheter,” filed Sep. 27, 2002, Ser. No. 60/414,248, which isincorporated herein in its entirety by reference, can be used to providethe blood glucose values to the infusion pump control and the existingIV connection can be used to administer the insulin to the patient.

It is important to appreciate that numerous combinations of devices inthe hospital-based system can be used with the closed loop controller ofthe present invention. For example, as described in FIG. 39B compared tothe preferred system in FIG. 39A, an auto blood glucose/intravenousinsulin infusion system can automatically withdraw and analyze blood forglucose concentration at fixed intervals (preferably 5-20 minutes),extrapolate the blood glucose values at a more frequent interval(preferably 1 minute), and use the extrapolated signal for calculatingan IV-insulin infusion according to the controller described below. Themodified auto blood glucose/intravenous insulin infusion system wouldeliminate the need for subcutaneous sensor compensation and subcutaneousinsulin compensation (as described with regards to the lead-lagcompensator below). The automatic withdrawal of blood, and subsequentglucose determination can be accomplished with existing technology (e.g.VIA or Biostator like blood glucose analyzer) or by the system describedin FIG. 40. The system in FIG. 40 uses a peristaltic pump 420 towithdraw blood across an amperometric sensor 415 (the same technology asused in sensor 26) and then return the blood with added flush (0.5 to1.0 ml) from the reservoir 405. The flush can consist of any makeup ofsaline, heparin, glucose solution and/or the like. If the blood samplesare obtained at intervals longer than 1 minute but less than 20 minutes,the blood glucose determinations can be extrapolated on aminute-to-minute basis with extrapolation based on the present (n) andprevious values (n-1) to work with the logic of the controller asdescribed in detail below. For blood samples obtained at intervalsgreater than 20 minutes, a zero-order-hold would be used for theextrapolation. Based on these blood glucose values, the infusion devicecan administer insulin based on the closed loop controller described ingreater detail below.

In other modifications to the system, a manual blood glucose/intravenousinsulin infusion system can be used where frequent manual entry of bloodglucose values from a standard blood glucose meter (e.g., YSI, Beckman,etc.) and extrapolate the values at more frequent intervals (preferably1 min) to create a surrogate signal for calculating IV-insulin infusion.Alternatively, a sensor blood glucose/intravenous insulin infusionsystem can use a continuous glucose sensor (e.g., vascular,subcutaneous, etc.) for frequent blood glucose determination. Moreover,the insulin infusion can be administered subcutaneously rather thanintravenously in any one of the previous examples according to thecontroller described below.

In still further alternative embodiments, the system components may becombined in a smaller or greater number of devices and/or the functionsof each device may be allocated differently to suit the needs of theuser.

Controller

Once the hardware for a closed loop system is configured, such as in thepreferred embodiments described above, the effects of the hardware on ahuman body are determined by the controller. In preferred embodiments,the controller 12 is designed to model a pancreatic beta cell (β-cell).In other words, the controller 12 commands the infusion device 34 torelease insulin 24 into the body 20 at a rate that causes the insulinconcentration in the blood to follow a similar concentration profile aswould be caused by fully functioning human β-cells responding to bloodglucose concentrations in the body 20. In further embodiments, a“semi-closed-loop” system may be used, in which the user is prompted toconfirm insulin delivery before any insulin is actually delivered.

A controller that simulates the body's natural insulin response to bloodglucose levels not only makes efficient use of insulin but also accountsfor other bodily functions as well since insulin has both metabolic andmitogenic effects. Controller algorithms that are designed to minimizeglucose excursions in the body without regard for how much insulin isdelivered may cause excessive weight gain, hypertension, andatherosclerosis. In preferred embodiments, of the present invention, thecontroller 12 is intended to emulate the in vivo insulin secretionpattern and to adjust this pattern to be consistent with in vivo β-celladaptation. The in vivo β-cell response in subjects with normal glucosetolerance (NGT), with widely varying insulin sensitivity (S_(I)), is theoptimal insulin response for the maintenance of glucose homeostasis.

The β-Cell and PID Control

Generally, the in vivo β-cell response to changes in glucose ischaracterized by “first” and “second” phase insulin responses. Thisbiphasic insulin response is clearly seen during hyperglycemic clampsapplied to NGT subjects, as shown in FIG. 23B. During a hyperglycemicclamp the glucose level is rapidly increased from a basal level G_(B) toa new higher level G_(C) and then held constant at the higher-levelG_(C) as shown in FIG. 23A. The magnitude of the increase in glucose(ΔG) affects the insulin response. Four insulin response curves areshown for four different glucose clamp levels in FIG. 23B.

The biphasic insulin response of a β-cell can be modeled usingcomponents of a proportional, plus integral, plus derivative (PID)controller. A PID controller is selected since PID algorithms are stablefor a wide variety of non-medical dynamic systems, and PID algorithmshave been found to be stable over widely varying disturbances andchanges in system dynamics.

The insulin response of β-cells during a hyperglycemic clamp isdiagrammed in FIGS. 24A-E using the components of a PID controller tomodel the β-cell. A proportional component Up and a derivative componentU_(D) of the PID controller may be combined to represent a first phaseinsulin response 440, which lasts several minutes. An integral componentU_(I) of the PID controller represents a second phase insulin response442, which is a steady increase in insulin release under hyperglycemicclamp conditions. The magnitude of each component's contribution to theinsulin response is described by the following equations:Proportional Component Response: U _(P) =K _(P)(G−G _(B))Integral Component Response: U _(I) =K _(I)∫_(t) ₀ ^(t)(G−G _(B))dt+I_(B), and

Derivative Component Response:

${U_{D} = {K_{D}\frac{dG}{dt}}},$

Where

U_(P) is the proportional component of the command sent to the insulindelivery system,

U_(I) is the integral component of the command sent to the insulindelivery system,

U_(D) is the derivative component of the command sent to the insulindelivery system,

K_(P) is a proportional gain coefficient,

K_(I) is an integral gain coefficient,

K_(D) is a derivative gain coefficient,

G is a present blood glucose level,

G_(B) is a desired basal glucose level,

t is the time that has passed since the last sensor calibration,

t₀ is the time of the last sensor calibration, and

I_(B) is a basal insulin concentration at t₀, or can also be describedas U_(I)(t₀).

The combination of the PID components that model the two phases ofinsulin response by a β-cell is shown in FIG. 24E as it responds to thehyperglycemic clamp of FIG. 24A. FIG. 24E shows that the magnitude ofthe first phase response 440 is driven by the derivative andproportional gains, K_(D) and K_(P). And the magnitude of the secondphase response 442 is driven by the integral gain K_(I).

The components of the PID controller can also be expressed in itsdiscrete form:Proportional Component Response: P _(cOn) ^(n) =K _(P)(SG_(f) ^(n) −G_(sp))Integral Component Response: I _(con) ^(n) =I _(con) ^(n−1) +K_(I)(SG_(f) ^(n) −G _(sp)); I _(con) ⁰ =I _(b)Derivative Component Response: D _(con) ^(n) =K _(D) dGdt _(f) ^(n)

Where K_(P), K_(I), and K_(D) are the proportional, integral, andderivative gain coefficients, SG_(f) and dGdt_(f) are the filteredsensor glucose and derivative respectively, and the superscript n refersto discrete time.

An acute insulin response is essential for preventing wide postprandialglycemic excursions. Generally, an early insulin response to a suddenincrease in glucose level results in less total insulin being needed tobring the glucose level back to a desired basal glucose level. This isbecause the infusion of insulin increases the percentage of glucose thatis taken up by the body. Infusing a large amount of insulin to increasethe percentage of glucose uptake while the glucose concentration is highresults in an efficient use of insulin. Conversely, infusing a largeamount of insulin while the glucose concentration is low results inusing a large amount of insulin to remove a relatively small amount ofglucose. In other words, a larger percentage of a big number is morethan a larger percentage of a small number. The infusion of less totalinsulin helps to avoid development of insulin resistance in the user. Aswell, first-phase insulin is thought to result in an early suppressionof hepatic glucose output.

Insulin sensitivity is not fixed and can change dramatically in a bodydepending on the amount of exercise by the body. In one study, forexample, insulin responses in highly exercise-trained individuals(individuals who trained more than 5 days a week) were compared to theinsulin responses in subjects with normal glucose tolerance (NGT) duringa hyperglycemic clamp. The insulin response in exercise-trainedindividuals 444 was about one-half of the insulin response of the NGTsubjects 446, as shown in FIG. 25A. But the glucose uptake rate for eachof the individuals (exercise-trained 448 or normal 450) was virtuallyidentical, as shown in FIG. 25B. Thus, it can be speculated that theexercise-trained individuals have twice the insulin sensitivity and halfof the insulin response leading to the same glucose uptake as the NGTindividuals. Not only is the first phase insulin response 440 reduceddue to the effects of exercise, but the second phase insulin response442 has also been shown to adjust to insulin sensitivity, as can be seenin FIG. 25A.

In preferred embodiments, a closed loop control system may be used fordelivering insulin to a body to compensate for β-cells that performinadequately. There is a desired basal blood glucose level G_(B) foreach body. The difference between the desired basal blood glucose levelG_(B) and an estimate of the present blood glucose level G is theglucose level error G_(E) that must be corrected. The glucose levelerror G_(E) is provided as an input to the controller 12, as shown inFIG. 26.

If the glucose level error G_(E) is positive (meaning that the presentestimate of the blood glucose level G is higher than the desired basalblood glucose level G_(B)) then the controller 12 generates an insulindelivery command 22 to drive the infusion device 34 to provide insulin24 to the body 20. In terms of the control loop, glucose is consideredto be positive, and therefore insulin is negative. The sensor 26 sensesthe ISF glucose level and generates a sensor signal 16. The sensorsignal 16 is filtered and calibrated to create an estimate of thepresent blood glucose level 452. In particular embodiments, the estimateof the present blood glucose level G is adjusted with correctionalgorithms 454 before it is compared to the desired basal blood glucoselevel G_(B) to calculate a new glucose level error G_(E) to start theloop again.

If the glucose level error G_(E) is negative (meaning that the presentestimate of the blood glucose level is lower than the desired basalblood glucose level G_(B)) then the controller 12 reduces or stops theinsulin delivery depending on whether the integral component response ofthe glucose error G_(E) is still positive.

If the glucose level error G_(E) is zero, (meaning that the presentestimate of the blood glucose level is equal to the desired basal bloodglucose level G_(B)) then the controller 12 may or may not issuecommands to infuse insulin depending on the derivative component(whether the glucose level is raising or falling) and the integralcomponent (how long and by how much glucose level has been above orbelow the basal blood glucose level G_(B)). In “semi-closed loop”embodiments, the user is prompted before the controller 12 issues thecommands to infuse insulin. The prompts may be displayed to the user ona display, sounded to the user, or otherwise provide an indication tothe user that the system is ready to deliver insulin, for example avibration or other tactile indication. In addition, the amount ofinsulin to be delivered may be displayed, with or without otherinformation, such as the total amount infused for the day or thepotential effect on the user's blood glucose level by the insulindelivery. In response, the user may indicate that the insulin should orshould not be delivered, for example by selecting a button, key, orother input. In further embodiments, there must be at least twokeystrokes so that insulin is not delivered by accident.

To more clearly understand the effects that the body has on the controlloop, a more detailed description of the physiological effects thatinsulin has on the glucose concentration in the interstitial fluid (ISF)is needed. In preferred embodiments, the infusion device 34 deliversinsulin through the cannula 56 of the infusion set 38 into the ISF ofthe subcutaneous tissue 44 of the body 20. And the insulin 24 diffusesfrom the local ISF surrounding the cannula into the blood plasma andthen spreads throughout the body 20 in the main circulatory system, asdescribed in the block diagram of FIG. 27. The insulin then diffusesfrom the blood plasma into the interstitial fluid ISF substantiallythroughout the entire body. The insulin 24 binds with and activatesmembrane receptor proteins on cells of body tissues. This facilitatesglucose permeation into the activated cells. In this way, the tissues ofthe body 20 take up the glucose from the ISF. As the ISF glucose leveldecreases, glucose diffuses from the blood plasma into the ISF tomaintain glucose concentration equilibrium. Finally, the glucose in theISF permeates the sensor membrane and affects the sensor signal 16.

In addition, insulin has direct and indirect effects on liver glucoseproduction. Increased insulin concentration decreases liver glucoseproduction. Therefore, acute and immediate insulin response not onlyhelps the body to efficiently take up glucose but also substantiallystops the liver from adding to the glucose in the blood stream. Inalternative embodiments, insulin is delivered more directly into theblood stream instead of into the interstitial fluid, such as deliveryinto veins, arteries, the peritoneal cavity, or the like. And therefore,any time delay associated with moving the insulin from the interstitialfluid into the blood plasma is diminished. In other alternativeembodiments, the glucose sensor is in contact with blood or body fluidsother than interstitial fluid, or the glucose sensor is outside of thebody and measures glucose through a non-invasive means. The embodimentsthat use alternative glucose sensors may have shorter or longer delaysbetween the blood glucose level and the measured blood glucose level.

Selecting Controller Gains

In preferred embodiments, the controller gains K_(P), K_(I), and K_(D),are selected so that the commands from the controller 12 cause theinfusion device 34 to release insulin 24 into the body 20 at a rate,that causes the insulin concentration in the blood to follow a similarconcentration profile, as would be caused by fully functioning humanβ-cells responding to blood glucose concentrations in the body. Inpreferred embodiments, the gains may be selected by observing theinsulin response of several normal glucose tolerant (NGT) individuals,with healthy normally functioning β-cells. The first step in determininga set of controller gains is to take periodic measurements of bloodglucose and blood insulin concentrations from the group of NGTindividuals. Second, each individual in the group is subjected to ahyperglycemic clamp, while continuing to periodically measure and recordthe blood glucose and blood insulin concentrations. Third, a leastsquares curve fit is applied to the recorded blood insulinconcentrations measured over time for each individual. The result is aset of curves representing the insulin responses to the hyperglycemicclamp for each individual of the group. Fourth, the curves are used tocalculate the controller gains K_(P), K_(I), and K_(D), for eachindividual. And finally, the proportional gains from each of theindividuals are averaged together to obtain an average proportionalgain, K_(P), to be used in a controller 12. Similarly, the integralgains, K_(I), and the derivative gains, K_(D), are averaged to obtain anaverage integral gain, K_(I) and an average derivative gain, K_(D), forthe controller 12. Alternatively, other statistical values may be usedinstead of averages such as, maximums, minimums, the high or low one,two or three sigma standard deviation values, or the like. The gainscalculated for various individuals in a group may be filtered to removeanomalous data points before statistically calculating the gains to beused in a controller.

In an example, a least squares curve-fitting method is used to generaterepresentative insulin response curves from two fasted individuals in agroup, as shown in FIGS. 28A and B. Then the controller gains werecalculated from the insulin response curves of the two representativeindividuals and are shown in Table 1. When calculating the controllergains, the insulin clearance rate (k), was assumed to be 10 (ml ofinsulin)/min/(kg. of body weight). The insulin clearance rate k is therate that insulin is taken out of the blood stream in a body. Finally,the average value for each type of gain is calculated using themeasurements from the group, as shown in Table 1.

TABLE 1 PID Controller Gains Calculated From The Insulin Response CurvesOf Two NGT Individuals Proportional Integral Derivative IndividualsGain, K_(P) Gain, K_(I) Gain, K_(D) a 0.000406 0.005650 0.052672 b0.000723 0.003397 0.040403 Average 0.000564 0.004523 0.046537

The controller gains may be expressed in various units and/or may bemodified by conversion factors depending on preferences for British orS. I. Units, floating-point or integer software implementation, thesoftware memory available, or the like. The set of units for thecontroller gains in Table 1 is:

K_(P): (mU of insulin)/min/(Kg of body weight) per (mg of glucose)/(dlof plasma);

K_(I): (mU of insulin)/min/(Kg of body weight) per (mg of glucose)/(dlof plasma) min.; and

K_(D): (mU of insulin)/min/(Kg of body weight) per (mg of glucose)/(dlof plasma)/min.

In alternative embodiments, other curve fitting methods are used togenerate the insulin response curves from the measurements of bloodinsulin concentrations.

An estimate of an insulin clearance rate (k), the individual's bodyweight (W), and the insulin sensitivity S_(I) are needed to calculatethe controller gains from the insulin response curves for each NGTindividual. The insulin clearance rate (k) is generally proportional tobody weight and is well documented in literature. The individual'sinsulin sensitivity S_(I) may be measured using an intravenous glucosetolerance test, a hyperinsulinemic clamp, or in the case of a diabetic,comparing the individual's daily insulin requirement to their dailycarbohydrate intake.

In particular embodiments, two parameters, the insulin sensitivity S_(I)and the insulin clearance rate k, are measured for each individual. Inother embodiments, the insulin clearance rate k is estimated fromliterature given the individual's body weight. In other particularembodiments, longer or shorter insulin clearance times are used. Instill other embodiments, all of the parameters are estimated. Inadditional embodiments, one or more parameters are measured, while atleast one parameter is estimated from literature.

In other alternative embodiments, the controller gains are calculatedusing a group of individuals with similar body types. For example, theinsulin response to a hyperglycemic clamp may be measured for severaltall, thin, NGT, males in order to calculate the controller insulinresponse gains for each individual in the group. Then the gains arestatistically combined to generate a set of representative controllergains for tall, thin, NGT, males. The same could be done for othergroups such as, but not limited to, short, heavy, NGT, females; mediumheight, medium weight, highly exercised trained, females; average heightand weight 10 year olds; or the like. Then the controller gains areselected for each individual user based on the group that bestrepresents them. In further alternative embodiments, controller gainsare uniquely selected for each individual user. In particularembodiments, the controller gains for a user are selected based onmeasurements of insulin sensitivity, insulin clearing time, insulinappearance time, insulin concentration, body weight, body fatpercentage, body metabolism, or other body characteristics such aspregnancy, age, heart conditions, or the like.

In other alternative embodiments, the controller gains are estimated asa function of a user's body weight W and insulin sensitivity S_(I). Aseries of observations are used to justify this method. The firstobservation is that the controller gains are proportional to each other.In other words, small changes in glucose concentration cause a smallderivative response U_(D), a small proportional response U_(P) and asmall integral response U_(I). And larger changes in glucoseconcentration cause a proportionally larger derivative response U_(D), aproportionally larger proportional Up response and a proportionallylarger integral response U_(I), as shown in FIG. 23B. Changes in theglucose concentration proportionally affect all three components of thecontroller response U_(PID). The second observation is that the firstphase insulin response (ϕ1) is proportional to the derivative gainK_(D). And the third observation is that two constants may be readilyobtained from information in published literature or may be measuredfrom a cross-section of the general population. The two constants arethe insulin clearance rate (k) for a human given a body weight and thedisposition index (DI) for a human given a change in glucoseconcentration.

While there are multiple sources for the information needed to calculatethe insulin clearance rate k, one source is the article “Insulinclearance during hypoglycemia in patients with insulin-dependentdiabetes mellitus”, written by Kollind M et al., published in Horm MetabRes, 1991 July; 23(7):333-5. The insulin clearance rate k is obtainedfrom the insulin infused divided by the steady state plasma insulinconcentration. An insulin clearance constant A_(k), which is independentof an individual's body weight, may be obtained by dividing the insulinclearance rate k (measured from a particular individual) by theindividual's body weight. The insulin clearance constant A_(k) isgenerally the same for all humans, except under extenuatingcircumstances such as after an individual has contracted HIV, othermetabolic affecting diseases, or the like.

The disposition index (DI) for a human given a change in glucoseconcentration is available from information presented in the article“Quantification of the relationship between insulin sensitivity andbeta-cell function in human subjects. Evidence for a hyperbolicfunction”, written by Khan S E et al., published in Diabetes, 1993November; 42(11):1663-72.

Both the disposition index DI and the insulin clearance rate k may bemeasured directly from tests. The disposition index DI may be calculatedgiven the first phase insulin response measured form a glucose clamptest and the individual's insulin sensitivity measured from an insulinsensitivity test. The insulin clearance rate k may be measured from aninsulin clearance test. The glucose clamp test and the insulin clearancetest are described in the above-mentioned articles and are well known inthe art. The insulin sensitivity S_(I) may be measured using anintravenous glucose tolerance test or a hyperinsulinemic clamp test.

Given these observations, then the following parameters may be measuredfrom an NGT individual's insulin response to a glucose clamp: a desiredfirst phase insulin response ϕ1, the ratio of K_(D) to K_(p), and theratio of K_(D) to K_(I). Then the derivative gain K_(D) may becalculated from the first phase insulin response ϕ1 using the constantsk and DI. And finally K_(p) and K_(I) may be calculated using the ratiosof K_(D) to K_(p) and K_(D) to K_(I).

The first phase insulin response ϕ1 may be observed in a NGT individualas the area under the insulin response curve during approximately thefirst 10 minutes of a glucose clamp. The increase in the glucoseconcentration during the glucose clamp is ΔG=(G−GB), where G is equal toGc, the glucose concentration during the clamp, and G_(B) is the basalglucose concentration before the clamp.

The importance of the first phase insulin response ϕ1 has beenemphasized by studies indicating that, in subjects with normal glucosetolerance (NGT), the product of first phase insulin response ϕ1 andinsulin sensitivity (S_(I)) is a constant known as the dispositionindex, DI=ϕ1S_(I). Therefore,

${\phi\; 1} = {\frac{DI}{S_{I}}.}$

For a different ΔG there is a different ϕ1 and therefore a different DI.But, the ratio DI/ΔG is substantially constant even for differentindividuals with different insulin sensitivities.

The insulin sensitivity S_(I) is defined as the percentage of theglucose concentration that the body tissues will take up for a givenamount of insulin. The β-cell naturally adapts to changes in insulinsensitivity by adjusting the amount of insulin it secretes during thefirst phase insulin response ϕ1. This suggests that the body naturallyseeks an optimal level of glucose tolerance. A controller that mimicsthis characteristic of the β-cell more accurately simulates the body'snatural insulin response.

The instantaneous insulin response (RI) may be calculated given theinsulin clearance rate (k) and the first phase insulin response ϕ1,RI=kϕ1.

The insulin clearance rate k is proportional to body weight (W),therefore substituting a proportional constant A_(k) and the user's bodyweight W for k and replacing ϕ1 with the ratio of DI over S_(I) yieldsthe following equation:

$R_{I} = {A_{k}W{\frac{DI}{S_{I}}.}}$

The instantaneous insulin response R_(I) may also be expressed as theproduct of the derivative gain K_(D) and the change in glucoseconcentration AG, R_(I)=K_(D)ΔG.

Setting the two equations for R_(I) equal to each other and solving forK_(D) yields,

$K_{D} = {\frac{W}{S_{I}}{\frac{A_{k}{DI}}{\Delta\; G}.}}$

As mentioned above, DI/ΔG and A_(k) are constants available orcalculated from data in published literature. Combining the constantsinto a single constant,

$Q,{Q = \frac{A_{k}{DI}}{\Delta\; G}},$yields an equation for the derivative gain K_(D) that is a function ofthe user's body weight W and the user's insulin sensitivity

$S_{I},{K_{D} = {\frac{W}{S_{I}}{Q.}}}$

Once the derivative gain K_(D) is calculated, the proportional andintegral gains are calculated using ratios. The ratio of K_(D)/K_(P) canbe set to the dominant time constant for insulin action, ranging from10-60 minutes, but more typically 20-40 minutes and preferably 30minutes. For example, calculating K_(P) given K_(D) using a timeconstant of 30 minutes, yields the following relationship:

$\frac{K_{D}}{K_{P}} = { 30\Rightarrow K_{P}  = {\frac{K_{D}}{30}.}}$In a similar fashion, the ratio of K_(D)/K_(I) can be set to the averageratio measured from a population of NGT individuals. And K_(I) can becalculated from K_(D).

In particular embodiments, the user enters their body weight W andinsulin sensitivity S_(I) into the device that contains the controller.Then the controller gains are automatically calculated and used by thecontroller. In alternative embodiments, an individual enters the user'sbody weight W and insulin sensitivity S_(I) into a device and the deviceprovides the information to the controller to calculate the gains.

A study was conducted to confirm that the insulin response for anindividual could be reproduced using the glucose sensor as an input. Inthe study, glucose and insulin measurements were taken while ahyperglycemic clamp was applied to a NGT individual. The glucose levelmeasurements, shown in FIG. 29A, were used as the inputs to amathematical model created to simulate a PID insulin responsecontroller. The insulin dosing commanded by the controller in responseto the glucose clamp very closely approximates the actual insulinappearance in the NGT individual, as shown in FIG. 29B. The insulinconcentration measured from periodic blood samples 456 taken from theindividual during the test are represented by dots in FIG. 29B. Theoutput from the mathematical model simulating the insulin responsecommanded by the controller is shown as a solid line 458 in FIG. 29B.

Three different devices were used to measure the individual's bloodglucose during the study. Blood glucose meter readings 460 from periodicblood samples taken from the individual are represented by the dots inFIG. 29A. Two MiniMed sensors (such as those described in the sectionentitled “sensor”, below) were placed in the individual's subcutaneoustissue, and the sensor readings 462, 464 are shown as lines in FIG. 29A.The sensor readings 462, 464 are slightly delayed compared to the meterreadings 460. The delay is most likely due to the delay between bloodglucose and interstitial fluid (ISF) glucose and can be substantiallycorrected through the use of a filter if needed. In this study, thedelay was not corrected by a filter and did not significantly affect thecontroller's ability to command an insulin response that matches thenatural response of the NGT individual. This study indicates that thePID insulin response controller model is a good minimal model of insulinsecretion that captures the biphasic response of healthy β-cells.Correction of the delay is only expected to increase the accuracy of themodel.

Fuzzy Logic to Select Between Multiple Sets of Controller Gains

In preferred embodiments, one set of controller gains is used for aparticular individual. In alternative embodiments, more than one set ofcontroller gains is used, and fuzzy logic is used to select between setsof controller gains and to determine when to change from one set ofcontroller gains to another. In particular alternative embodiments, thecontroller gains are different if the glucose level is above or belowthe desired glucose basal level. In other alternative embodiments, thecontroller gains are different if the glucose level is increasing ordecreasing. A justification for different sets of gains comes fromphysiological studies that indicate that β-cells turn off faster thanthey turn on. In still other alternative embodiments, the controllergains are different depending on whether the glucose level is above orbelow the desired glucose basal level and whether the glucose level isincreasing or decreasing, which results in four sets of controllergains. In additional alternative embodiments, the controller gainschange depending on the magnitude of the hypoglycemic excursion. Inother words, the controller gains for small changes in glucose aredifferent than those for large changes in glucose.

Self-Tuning Controller Gains

Further embodiments may include a controller that self-tunes one or morethe gains, K_(P), K_(I), K_(D) to accommodate changes in insulinsensitivity. In particular embodiments, previous measurements of glucoselevels are compared to the desired basal glucose level G_(B). Forexample, the desired basal glucose level G_(B) is subtracted from theprevious glucose level measurements. Then any negative values, within apredefined time window, are summed (in essence integrating the glucoselevel measurements that were below the basal glucose level G_(B)). Ifthe resulting sum is greater than a pre-selected hypoglycemic integralthreshold, then the controller gains are increased by a factor (1+α).Conversely, if the integral of the glucose level measurements that weremeasured above the basal glucose level G_(B) within the predefined timewindow is greater than a pre-selected hyperglycemic integral threshold,then the controller gains are decreased by a factor (1−α).

In particular embodiments, the predefined time window over which theglucose concentration integrals are evaluated is generally 24 hours, andthe controller gains are adjusted if needed at the end of eachpredefined time window. In alternative embodiments, the integrals of theglucose level measurements are continuously calculated over a movingwindow of time, and if either integral exceeds a threshold, the gainsare immediately adjusted. In particular embodiments, the moving timewindow is one hour, and the time window may be restarted whenever thegains are adjusted. In other alternative embodiments, the time window islonger or shorter depending on the sensor accuracy, the rate at which anindividual's insulin sensitivity changes, the computational capabilitiesof the hardware, or the like.

In particular embodiments, the adjustment amount (α) is 0.01. Inalternative embodiments, the adjustment amount α is greater or smallerdepending on the sensor accuracy, the rate at which an individual'sinsulin sensitivity changes, the rate at which the sensor sensitivityS_(I) changes, or the like. In still other alternative embodiments, theadjustment amount α is made larger or smaller depending on the amountthat the integral of the measured glucose levels exceeds a threshold. Inthis way, the gains are adjusted by greater amounts if the measuredglucose level G is significantly deviating from the desired bloodglucose level G_(B) and less if the measured glucose level G is closerto the desired blood glucose level G_(B). In additional alternativeembodiments, the controller employs a Kalman filter.

State Variable Feedback

While the primary signal determining the β-cell's insulin response isglucose, there also exists a putative effect of insulin per se toinhibit insulin secretion. This effect may be directly related to theconcentration of insulin in plasma (IP(t)), or mediated through somesignal proportional to insulin effect (IEFF(t)). The β-cell can likelydirectly sense these signals (i.e., directly sense insulin concentrationand secondary signals proportional to insulin effect such as free fattyacid). Feedback from these intermediary signals is analogous to what isknown as state variable feedback; that is feedback, whereby the variablebeing controlled (glucose in this case) is used together with feedbackof each intermediary signal that affects the variable (insulinconcentration in plasma and interstitial fluid). With this type offeedback, undesirable slow kinetic process can be made to appear muchfaster than they are. For example, if β-cell insulin secretion wereinhibited by a signal proportional to insulin concentration in theinterstitial fluid where it acts, the delay between plasma andinterstitial insulin could be made to appear to be shorter. For theartificial closed-loop algorithm, or for “semi-closed-loop” algorithms,this beneficial effect can be achieved by using “state observers”(mathematical equations that predict the insulin concentration invarious parts of the body knowing the history of past insulin delivery).In “semi-closed loop” algorithms, the algorithms are the same as forclosed loop algorithms but there is a user confirmation step before anyinsulin is actually administered. By using state variable feedback, itis possible to make the insulin in an insulin pump act faster than theinsulin actually is.

To estimate subcutaneous insulin concentration, plasma insulinconcentration, and insulin effect, the following equations may be used:

$\frac{{dI}_{SC}}{dt} = {\alpha_{1}( {I_{D} - I_{SC}} )}$$\frac{{dI}_{P}}{dt} = {\alpha_{2}( {I_{SC} - I_{P}} )}$$\frac{{dI}_{EF}}{dt} = {\alpha_{3}( {I_{P} - I_{EF}} )}$

Wherein I_(SC) is the estimate of normalized insulin concentration inthe subcutaneous space, I_(P) is the estimate of normalized insulinconcentration in the plasma, I_(EF) is the estimate of insulin effect onglucose, α₁ is the rate constant between insulin delivery and thesubcutaneous insulin compartment, α₂ is the rate constant betweensubcutaneous insulin and plasma compartments, α₃ is the rate constantbetween the plasma compartment and the insulin effect. I_(D) is thedelivered insulin, which can be a function of the three state variables(I_(SC), I_(P), and I_(EF)).

In particular embodiments, an open loop fixed base rate plus userrequested bolus would result in the bolus being increased a certainamount and the basal rate subsequently decreased the same amount inaccordance to the following formula:I _(D)′=(1+γ₁+γ₂+γ₃)I _(D)−γ₁ I _(SC)−γ₂ I _(P)−γ₃ I _(EF)

Wherein I_(D) is the user requested basal (U/h) plus bolus (U) profileand I_(D)′ is the state feedback adjusted profiles. Note that for agiven kinetic excursion the total amount of insulin requested (areaunder curve of I_(D)) and delivered (area under curve of I_(D)′) isidentical. Here, γ₁, γ₂, and γ₃ are state-feedback gains (scalars).Careful choice of these gains the pump to correct its delivery rate tocompensate for delays associated with the dispersion of insulin from thebolus injection into the subcutaneous layer of the patient, to theplasma, and to its actual insulin effect/action on the body. Thus, byestimating how much insulin from a bolus is in the subcutaneous layer,the plasma, or is actually acting on the patient's glucose level (statevariables I_(SC), I_(P) and I_(EF)), it is possible to optimize deliveryof insulin over time to the patient. Using state feedback the bolus isincreased by an amount (1+γ₁+γ₂+γ₃) that is gradually taken away fromfuture insulin delivery (−γ₁I_(SC)−γ₂I_(P)−γ₃I_(EF)). As a result, theapparent insulin pharmokinetic curve appears faster. This is akin todeveloping a faster acting insulin, but it is achieved algorithmicallyby rearranging the distribution of the insulin delivery per unit bolusby delivering more upfront and removing the extra amount at a latertime. The three gains can be chosen to move the time delays (1/α₁, 1/α₂,and 1/α₃) to any arbitrary locations. In control theory, this is knownas pole placement.

State feedback can be used in open loop and closed loop insulin deliveryalgorithms and with “semi-closed-loop” delivery algorithms. Statefeedback can be used in conjunction with aProportional-Integral-Derivative (PID) or any other type of closed loopcontroller. γ₁ is the feedback gain multiplied to I_(SG), γ₂ is thefeedback gain multiplied to I_(P), and γ₃ is the feedback gainmultiplied to I_(EF).

The physical state space form directly taken from the equations aboveis:

$\{ {\begin{matrix}{\begin{bmatrix}{\overset{.}{I}}_{SC} \\{\overset{.}{I}}_{P} \\{\overset{.}{I}}_{EF}\end{bmatrix} = {{\begin{bmatrix}{- \alpha_{1}} & 0 & 0 \\\alpha_{2} & {- \alpha_{2}} & 0 \\0 & \alpha_{3} & {- \alpha_{3}}\end{bmatrix} \cdot \begin{bmatrix}I_{SC} \\I_{P} \\I_{EF}\end{bmatrix}} + {\begin{bmatrix}\alpha_{1} \\0 \\0\end{bmatrix} \cdot I_{D}}}} \\{I_{D} = {{\begin{bmatrix}0 & 0 & 0\end{bmatrix} \cdot \begin{bmatrix}I_{SC} \\I_{P} \\I_{EF}\end{bmatrix}} + {\begin{bmatrix}1 \\0 \\0\end{bmatrix} \cdot I_{D}}}}\end{matrix}{or}\{ \begin{matrix}{\overset{.}{x} = {{Ax} + {Bu}}} \\{y = {{Cx} + {du}}}\end{matrix} } $

The finite difference form is calculated as follows (wherein e^(X)indicates an exponential function):

Define: k₁=e^(−α) ¹ ^(T), k₂=e^(−α) ² ^(T), k₃=e^(−α) ¹ ^(T)I _(SC)(i)=(1−k ₁)(I _(D)(i−1))+k ₁ I _(SC)(i−1)  (eq 1b)I _(P)(i)=(1−k ₂)(I _(SC)(i)+k ₂ I _(P)(i−1)  (eq 2b)I _(EF)(i)=(1−k ₃)(I _(P)(i))+k ₃ I _(EF)(i−1)  (eq 3b)

The Laplace Form is as follows, wherein s represents the Stäckeldeterminant used in Laplace equations:

$\begin{matrix}{\frac{I_{SC}}{I_{D}} = \frac{\alpha_{1}}{s + \alpha_{1}}} & ( {{eq}\mspace{14mu} 1c} ) \\{\frac{I_{P}}{I_{SC}} = \frac{\alpha_{2}}{s + \alpha_{2}}} & ( {{eq}\mspace{14mu} 2c} ) \\{\frac{I_{EFF}}{I_{P}} = \frac{\alpha_{3}}{s + \alpha_{3}}} & ( {{eq}\mspace{14mu} 3c} ) \\{\frac{I_{P}}{I_{D}} = \frac{\alpha_{1}\alpha_{2}}{( {s + \alpha_{1}} )( {s + \alpha_{2}} )}} & ( {{eq}\mspace{14mu} 4} ) \\{\frac{I_{EFF}}{I_{D}} = \frac{\alpha_{1}\alpha_{2}\alpha_{3}}{( {s + \alpha_{1}} )( {s + \alpha_{2}} )( {s + \alpha_{3}} )}} & ( {{eq}\mspace{14mu} 5} )\end{matrix}$

To obtain the transfer function of insulin delivery with state feedback,the control equation is as follows, wherein E represents the errorbetween the actual glucose concentration and the desired glucoseconcentration (G−G_(D)):I _(D) =PID·E−γ ₁ I _(SC)−γ₂ I _(P)−γ₃ I _(EFF)  (eq 6)Substituting equations (eq 1c), (eq 4) and (eq 5) into (eq 6) andrearranging, the following transfer functions are obtained, wherein GMis a gain multiplier:

$\begin{matrix}{\frac{I_{D}}{E} = \frac{({GM})({PID})( {s + \alpha_{1}} )( {s + \alpha_{2}} )( {s + \alpha_{3}} )}{\begin{matrix}{{( {s + \alpha_{1}} )( {s + \alpha_{2}} )( {s + \alpha_{3}} )} + {\alpha_{1}{\gamma_{1}( {s + \alpha_{2}} )}( {s + \alpha_{3}} )} +} \\{{\alpha_{1}\alpha_{2}{\gamma_{2}( {s + \alpha_{3}} )}} + {\alpha_{1}\alpha_{2}\alpha_{3}\gamma_{3}}}\end{matrix}}} & ( {{eq}\mspace{14mu} 7} ) \\{\frac{I_{SC}}{E} = \frac{({GM})({PID}){\alpha_{1}( {s + \alpha_{2}} )}( {s + \alpha_{3}} )}{\begin{matrix}{{( {s + \alpha_{1}} )( {s + \alpha_{2}} )( {s + \alpha_{3}} )} + {\alpha_{1}{\gamma_{1}( {s + \alpha_{2}} )}( {s + \alpha_{3}} )} +} \\{{\alpha_{1}\alpha_{2}{\gamma_{2}( {s + \alpha_{3}} )}} + {\alpha_{1}\alpha_{2}\alpha_{3}\gamma_{3}}}\end{matrix}}} & ( {{eq}\mspace{14mu} 8} ) \\{\frac{I_{P}}{E} = \frac{({GM})({PID})\alpha_{1}{\alpha_{2}( {s + \alpha_{3}} )}}{\begin{matrix}{{( {s + \alpha_{1}} )( {s + \alpha_{2}} )( {s + \alpha_{3}} )} + {\alpha_{1}{\gamma_{1}( {s + \alpha_{2}} )}( {s + \alpha_{3}} )} +} \\{{\alpha_{1}\alpha_{2}{\gamma_{2}( {s + \alpha_{3}} )}} + {\alpha_{1}\alpha_{2}\alpha_{3}\gamma_{3}}}\end{matrix}}} & ( {{eq}\mspace{14mu} 9} ) \\{\frac{I_{EFF}}{E} = \frac{({GM})({PID})\alpha_{1}\alpha_{2}\alpha_{3}}{\begin{matrix}{{( {s + \alpha_{1}} )( {s + \alpha_{2}} )( {s + \alpha_{3}} )} + {\alpha_{1}{\gamma_{1}( {s + \alpha_{2}} )}( {s + \alpha_{3}} )} +} \\{{\alpha_{1}\alpha_{2}{\gamma_{2}( {s + \alpha_{3}} )}} + {\alpha_{1}\alpha_{2}\alpha_{3}\gamma_{3}}}\end{matrix}}} & ( {{eq}\mspace{14mu} 10} )\end{matrix}$

The computation of the gain multiplier is also obtained in the statevariable feedback method. When state variable feedback is used, the gainmultiplier (GM) is a scalar that forces a step response to reach thesame steady value whether state feedback is used or not. In other words,GM ensures that the total amount given per unit of bolus will be thesame in both cases. In the case of state feedback, more insulin is givenup front, but this extra insulin is taken away later. To calculate GM inparticular embodiments, the “final value theorem” from control systemsis used. The final value theorem states that to evaluate the steadystate of any transfer function T(s) given any input X(s), the steadystate output response to the input is given by:y _(SS)(t→∞)=lim _(s→0)(sT(s)X(s))

The Laplace form of a step input is given by

${X(s)} = \frac{1}{s}$and the steady state solution of the final value theorem simplifies to:y _(SS)(t→∞)=lim _(s→0)(T(s)).In the case when there is no state feedback, (γ₁, γ₂ and γ₃=0), thesteady state solution may be obtained from equation (eq 7) to be asfollows:I _(D)(t→∞)=1  (eq 11)With state feedback without the gain correction factor, the steady statesolution is:

$\begin{matrix}{{I_{D}( tarrow\infty )} = \frac{1}{1 + \gamma_{1} + \gamma_{2} + \gamma_{3}}} & ( {{eq}\mspace{14mu} 12} )\end{matrix}$GM is then evaluated as the ratio of equation (eq 12) to equation (eq11) to obtain the following: GM=1+γ₁+γ₂+γ₃.

Using state variable feedback, a closed loop control equation and statefeedback gain are determined for pole placement. Specifically, the gainsare calculated for the insulin delivery equation shown above. Inparticular embodiments, they are determined as follows: First, withstate feedback, the denominator of equations (eq 7), (eq 8), (eq 9), and(eq 10) is:D=s ³+(α₁+α₂+α₃+γ₁α₁)s²+(α₁α₂+(α₁+α₂)α₃+γ₂α₁α₂+(α₂+α₃)γ₁α₁)s+(α₁α₂α₃+γ₃α₁α₂α₃+γ₂α₁α₂α₃+γ₁α₁α₂α₃)  (eq14)

To get the poles of the system in the equations (eq 7), (eq 8), (eq 9),or (eq 10), D may be set equal to zero yield the characteristicequation:s ³+(α₁+α₂+α₃+γ₁α₁)s²+(α₁α₂+(α₁+α₂)α₃+γ₂α₁α₂+(α₂+α₃)γ₁α₁)s+(α₁α₂α₃+γ₃α₁α₂α₃+γ₂α₁α₂α₃+γ₁α₁α₂α₃)=0  (eq16)If the desired system poles or roots of (eq 16) are defined byeigenvalues λ₁, λ₂ and λ₃, then the characteristic equation can bewritten as:(s−λ ₁)(s−λ ₂)(s−λ ₃)=0Expanding and collecting like powers of s, (eq 16) can be written as:s ³−(λ₁+λ₂+λ₃)s ²+(λ₁λ₂+λ₁λ₃+λ₂λ₃)s−λ ₁λ₂λ₃=0  (eq 17)

Setting the coefficients of like powers of s equal to each other we havethe system of equations:α₁+α₂+α₃+γ₁α₁=(λ₁+λ₂+λ₃)  (eq 18)α₁α₂+α₁α₃+α₂α₃+γ₂α₁α₂+γ₁α₁(α₂+α₃)=λ₁λ₂+λ₁λ₃+λ₂λ₃  (eq 19)α₁α₂α₃+γ₃α₁α₂α₃+γ₂α₁α₂α₃+γ₁α₁α₂α₃=λ₁λ₂λ₃  (eq 20)

This results in three equations and three unknowns, γ₁, γ₂ and γ₃.Therefore, the unknown gains can be solved for in terms of the desiredpoles λ₁, λ₂, λ₃, and system time constants, α₁, α₂ and α₃. Theseformulas enable us to control the desired pharmacokinetics of insulin asit appears in the different compartments:

$\gamma_{1} = \frac{- ( {\lambda_{1} + \lambda_{2} + \lambda_{3} + \alpha_{1} + \alpha_{2} + \alpha_{3}} )}{\alpha_{1}}$$\gamma_{2} = \frac{\begin{matrix}{{\lambda_{1}\lambda_{2}} + {\lambda_{1}\lambda_{3}} + {\lambda_{2}\lambda_{3}} - {\alpha_{1}\alpha_{2}} - {\alpha_{1}\alpha_{3}} - {\alpha_{2}\alpha_{3}} +} \\{( {\lambda_{1} + \lambda_{2} + \lambda_{3} + \alpha_{1} + \alpha_{2} + \alpha_{3}} )( {\alpha_{2} + \alpha_{3}} )}\end{matrix}}{\alpha_{1}\alpha_{2}}$$\gamma_{3} = {\frac{{- \lambda_{1}}\lambda_{2}\lambda_{3}}{\alpha_{1}\alpha_{2}\alpha_{3}} - \frac{\begin{matrix}{{\lambda_{1}\lambda_{2}} + {\lambda_{1}\lambda_{3}} + {\lambda_{2}\lambda_{3}} - {\alpha_{1}\alpha_{2}} - {\alpha_{1}\alpha_{3}} - {\alpha_{2}\alpha_{3}} +} \\{( {\lambda_{1} + \lambda_{2} + \lambda_{3} + \alpha_{1} + \alpha_{2} + \alpha_{3}} )( {\alpha_{2} + \alpha_{3}} )}\end{matrix}}{\alpha_{1}\alpha_{2}} + \frac{( {\lambda_{1} + \lambda_{2} + \lambda_{3} + \alpha_{1} + \alpha_{2} + \alpha_{3}} )}{\alpha_{1}} - 1}$

Thus, through the above calculations, the gains can be calculated andused in the control equation for insulin delivery of:I _(D) =PID·E−γ ₁ I _(SC)−γ₂ I _(P)−γ₃ I _(EF)

PID is the output of a PID controller of any other closed loop (or“semi-closed-loop”) controller. The gains are generally calculated justonce, but could be calculated more often if desired. The controlequation may be calculated on a repeated basis, after predeterminedperiods of time or continuously. For example, and without limitation, itmay be calculated every five, ten, thirty or sixty minutes. Just thestate variable portion (γ₁I_(SC)−γ₂I_(P)−γ₃I_(EF)) may be updated or theentire equation may be updated. By updating the control equation, it ispossible to continually improve the delivery of insulin to the patient.

A control feedback block diagram of an embodiment of a pump using statevariable feedback is shown in FIG. 42. As shown, the desired glucoseG_(D) 600 of the patient is entered into the PID Controller 610. Theoutput of the PID controller is an insulin delivery value I_(D) 601. Theblock then calculates how much insulin should actually be delivered tothe patient as a bolus in addition to the insulin delivery value and howmuch should be taken away from the basal rate, as discussed above. Ateach discrete time interval, Ti, (T1 620, T2 630, and T3 640), theamount of insulin that has entered into the subcutaneous layer from thepump is calculated to provide I_(SC) 602. That value will be multiplied(or otherwise factored by) γ₁ 605 and subtracted from the output of thePID controller to provide an improved desired insulin value based on thesubcutaneous insulin concentration (with the other calculationsfollowing). At each discrete time interval Ti, the amount of insulinthat has entered into the plasma from the subcutaneous compartment iscalculated to provide I_(P) 603. That value will be multiplied (orotherwise factored by) γ₂ 606 and subtracted from the output of the PIDcontroller to determine an improved desired insulin value based on theplasma insulin concentration. At each discrete time interval Ti, theamount of insulin actually going into action or the effective insulincompartment from the insulin in the plasma is calculated to provideI_(EF) 604. That value will be multiplied (or otherwise factored by) γ₃607 and subtracted from the output of the PID controller to determine animproved desired insulin value based on the effective insulin. Theinsulin actually delivered to the subject 650 will then change the bloodglucose G of the user 608, which will then be measured by the sensor 660and compared to the desired glucose 600.

FIGS. 43-46 show graphs with the effect of state feedback. FIG. 43 showsthe effect on the basal insulin delivery rate achieved using thealgorithm described above. A bolus is given at time zero. Line 700 showsthe insulin delivery when no state feedback is used. This line would bethe same as a regular delivery of an insulin bolus and is indicated as0.0000, because it does not change the amount of basal rate beingdelivered. The other three lines illustrate the change in insulindelivery rate over time when all of the state feedback is placed in oneof the gains γ₁, γ₂, or γ₃. As can be seen, if all the state feedback isplaced in the gain γ₁ (for the subcutaneous layer), the basal insulindelivery rate 701 (in relation to the standard basal rate) starts outlow and gradually moves to a limit of zero, or the rate without statefeedback, as steady state is reached. If all of the state feedback isplaced in the gain γ₂ (for the plasma layer), the basal insulin deliveryrate 702 starts at zero, dips lower, and then gradually returns up to alimit of zero as steady state is reached. If all of the state feedbackis placed in the gain γ₃ (for the insulin action/effect), the basalinsulin delivery rate 703 starts at zero, dips lower, but more slowlythan for the all γ₂ delivery rate, and then gradually returns up to alimit of zero as steady state is reached. In all cases, the totaldelivery of insulin is the same.

FIG. 44 shows the effect of state feedback per unit bolus on thesubcutaneous insulin. In other words, a bolus of insulin is given to apatient at time zero and the figure shows the rate in which the amountof insulin in the subcutaneous layer, from that bolus, decreases tozero. Line 705 shows the amount of insulin in the subcutaneous layerover time with no state feedback. Line 706 shows the amount of insulinin the subcutaneous layer over time when all of the state feedback isplaced in gain γ₁. Line 707 shows the amount of insulin in thesubcutaneous layer over time when all of the state feedback is placed ingain γ₂. Line 708 shows the amount of insulin in the subcutaneous layerover time when all of the state feedback is placed in gain γ₃.

FIG. 45 shows the effect of state feedback per unit bolus on the plasmainsulin. In other words, a bolus of insulin is given to a patient attime zero and the figure shows the rate in which the amount of insulinin the plasma layer, from that bolus, increases from zero (there is aslight delay from injecting insulin to when the insulin moves into theplasma from the subcutaneous layer), reaches its peak and then returnsto zero. Line 710 shows the amount of insulin in the plasma over timewith no state feedback. Line 711 shows the amount of insulin in theplasma over time when all of the state feedback is placed in gain γ₁.Line 712 shows the amount of insulin in the plasma over time when all ofthe state feedback is placed in gain γ₂. Line 713 shows the amount ofinsulin in the plasma over time when all of the state feedback is placedin gain γ₃.

FIG. 46 shows the effect of state feedback per unit bolus on the insulineffect. In other words, a bolus of insulin is given to a patient at timezero and the figure shows the rate in which the amount of insulin fromthat bolus creates the insulin effect on the body, starting at zero(there is a delay from the injection of insulin into the subcutaneouslayer and through the plasma to the insulin effect), rising to itsmaximum point, and decreasing to zero. Line 715 shows the insulin effectover time with no state feedback. Line 716 shows the insulin effect overtime when all of the state feedback is placed in gain γ₁. Line 717 showsthe insulin effect over time when all of the state feedback is placed ingain γ₂. Line 718 shows the insulin effect over time when all of thestate feedback is placed in gain γ₃.

FIGS. 47 and 48 compare insulin state variable feedback used inconjunction with a PID closed loop controller as opposed to use of a PIDclosed loop controller alone (with no insulin state variable feedback).FIG. 47 shows the simulated glucose concentration of a patient overtime. Meals are given at 8, 13, 18, 22, and 32 hours. The glucoseconcentration using the PID with insulin state feedback is shown as line800. The glucose concentration using the PID without insulin statefeedback is shown as line 801. With glucose concentrations, it is alwayspreferable to keep a patient's concentrations from being too high or toolow, so the more that the closed loop program can avoid high and lowvalues, the better. As can be seen in FIG. 47, as time goes on, theglucose concentration using the PID with insulin state feedback improvesover time (versus the glucose concentration using the PID withoutinsulin state feedback) in that it varies less as time goes on, keepingthe patient with a more steady glucose level that will greatly reducehyper- and hypoglycemic events. FIG. 48 shows average simulated insulindelivery profiles from the same system as FIG. 47. Line 810 representsthe insulin delivery using the PID with insulin state feedback. Line 811represents the insulin delivery using the PID without insulin statefeedback. As can be seen, the insulin delivery using the PID withinsulin state feedback contains more spikes and dips, resulting from thestate feedback.

Modifying the PID Controller to Incorporate an Integrator Leak

In preferred embodiments, the PID control response was described withconstant gain components, K_(P), K_(I), K_(D). Although the preferredcontrol response guarantees zero steady-state error (i.e., steady stateglucose minus a desired basal glucose (G_(B))=0), inherently, theintegral component U_(I)=K_(I)∫_(t) ₀ ^(t)(G−G_(B))dt+U_(I)(t₀)destabilizes feedback control because there is no temporal wind down ofthe insulin response while the integral component models the increase inthe insulin response. Without any correction, the integral component hasa tendency to over-estimate the increase in the insulin response. Sincea small difference between steady-state glucose and G_(B) is typicallyacceptable in insulin response control, an alternative modeling of theintegral component can incorporate an integrator leak to reduce themagnitude of the destabilizing effect. Specifically, changes in U_(I)(t)can be described by a term proportional to the error in glucose and aterm that leaks in proportion to the magnitude of U_(I). This can beexpressed in the formula:

${{\frac{{dU}_{I}}{dt}{K_{I}( {G - G_{B}} )}} - {K_{LEAK}U_{I}}};$with initial condition U_(I)(t₀).

The parameter K_(LEAK) is the reciprocal time constant of the rate ofleaking (τ_(LEAK) in min=1/K_(LEAK)), where τ_(LEAK) is a tuningparameter that can be set based on empirical data, and be tied with theother gain components K_(P), K_(I), K_(D). However, the currentrealization of the artificial β-cell has T_(LEAK) as a user input. U_(I)can also be expressed in discrete form by standard methods.

Post-Controller (Lead/Lag) Compensator

In preferred embodiments, commands are issued from the controllerwithout regard to where in the body the insulin delivery system willinfuse the insulin. In essence, the assumption is that the insulin iseither delivered directly into the blood stream for immediate use by thebody, or that any time delays caused by delivering the insulin somewherein the body other than the blood stream can be compensated for byadjusting K_(P), K_(I), and K_(D). In this case, the commands generallymodel a β-cell insulin secretion profile, an example of which is shownin FIG. 35A. And since the β-cells secrete insulin directly into theblood stream, the β-cell insulin secretion profile is the intended bloodplasma insulin concentration profile. However, an insulin delivery delaymay distort the intended blood plasma insulin concentration profile, asshown in FIG. 35B. The insulin delivery delay is the amount of timebetween the instant that the command is given to the insulin deliverysystem to infuse insulin and the time that insulin reaches the bloodplasma. An insulin delivery delay may be caused by a diffusion delay,represented by a circle with an arrow 528 in FIG. 20, which is the timerequired for insulin that has been infused into a tissue to diffuse intothe blood stream. Other contributors to insulin delivery delay mayinclude, time for the delivery system to deliver the insulin to the bodyafter receiving a command to infuse insulin, time for the insulin tospread throughout the circulatory system once it has entered the bloodstream, and/or by other mechanical or physiological causes. In addition,the body clears insulin even while an insulin dose is being deliveredfrom the insulin delivery system into the body. Since insulin iscontinuously cleared from the blood plasma by the body, an insulin dosethat is delivered to the blood plasma too slowly or is delayed is atleast partially, if not significantly, cleared before the entire insulindose fully reaches the blood plasma. And therefore, the insulinconcentration profile in the blood plasma never achieves the same peak(nor follows the same profile) it would have achieved if there were nodelay. Given an insulin dose delivered all at once into the blood plasmaat time zero, the insulin concentration in the blood plasma is raisedvirtually instantaneously (not shown) and then would decreaseexponentially over time as the body clears (uses or filters out) theinsulin, as shown in FIG. 36A per equation: where:

${C_{P} = {\frac{I_{0}}{V_{p}}e^{{- P_{1}}t}}},$

C_(P) is is the concentration of insulin in the blood plasma,

I₀ is a mass of the insulin dose delivered directly to the blood plasmaat time zero,

V_(p) is a volume of the blood plasma in the body,

P₁ is a reciprocal time constant for insulin clearance, and

t is the time that has passed since the delivery of the insulin dosedirectly into the blood plasma.

The time constant for insulin clearance P₁ may be calculated using thefollowing equation:

${P_{1} = {- \frac{k}{V_{p}}}},$wwere:

k is the volume insulin clearance rate, and

V_(p) is a volume of the blood plasma in the body.

Or the time constant for insulin clearance P₁ may be obtained byproviding insulin to an individual that does not generate his owninsulin, and then periodically testing blood samples from the individualfor insulin concentration. Then, using an exponential curve fittingroutine, generate a mathematical expression for a best-fit curve for theinsulin concentration measurements, and observe the time constant in themathematical expression.

Given the same insulin dose (delivered at time zero all at once) intothe subcutaneous tissue, instead of directly into the blood plasma, theconcentration of insulin in the blood plasma would begin to rise slowlyas insulin diffuses from the interstitial fluid ISF into the bloodplasma, as shown in FIG. 36B. At the same time that insulin is enteringthe blood plasma, the body is clearing insulin from the blood. While therate at which insulin is entering the blood plasma exceeds the insulinclearance rate, the insulin concentration in the blood plasma continuesto increase. When the insulin clearance rate exceeds the rate at whichinsulin is entering the blood plasma from the interstitial fluid ISF,the insulin concentration in the blood plasma begins to decrease. So,the result of delivering insulin into the interstitial fluid ISF insteadof directly into the blood stream is that the insulin concentration inthe blood plasma is spread over time rather than increased virtuallyinstantaneously to a peak followed by a decay.

A bi-exponential equation may be used to model the insulin concentrationin blood plasma given an insulin dose delivered to the subcutaneoustissue:

${C_{P} = {\frac{I_{0}D}{V_{p}{V_{I\; S\; F}( {P_{3} - P_{2}} )}}( {e^{{- P_{2}}t} - e^{{- P_{3}}t}} )}},$where:

C_(P) is the concentration of insulin in the blood plasma,

I₀ is the mass of the insulin dose delivered to the subcutaneous tissueat time zero,

D is a diffusion coefficient (the rate at which insulin diffuses fromthe interstitial fluid ISF into the blood glucose)

V_(p) is a volume of the blood plasma in the body,

V_(ISF) is a volume of interstitial fluid ISF that the insulin isdelivered to,

P₂ is a time constant,

P₃ is a time constant greater than or equal to P₂, and

t is time since the delivery of the insulin dose into the interstitialfluid ISF.

The time constants may be calculated using the quadratic formula:

$P_{2},{P_{3} = {- \frac{a_{1} \pm \sqrt{a_{1}^{2} - {4\; a_{0}}}}{2}}},{{where}\text{:}}$${a_{1} = {\frac{D + K}{V_{p}} + \frac{D}{V_{I\; S\mspace{11mu} F}}}},{and}$$a_{0} = {{( \frac{D + K}{V_{P}} )( \frac{D}{V_{I\; S\mspace{11mu} F}} )} - {\frac{D^{2}}{V_{I\; S\; F}V_{P}}.}}$

In alternative embodiments, a post-controller lead-lag compensator 522is used to modify the commands (U_(PID)) to compensate for the insulindelivery delay and/or the insulin clearance rate k, as shown in FIG. 37.The post-controller lead-lag compensator 522 is of the form

$\frac{U_{COMP}}{U_{PID}} = \frac{s + \alpha}{s + \gamma}$where 1/α and 1/γ are the lead and lag constants respectively, s is theLaplace variable, and U_(COMP) is the compensated commands calculated bythe lead-lag compensator 522.

The PID controller generates commands (U_(PID)) for a desired insulindelivery rate into the blood plasma. The commands U_(PID) are calculatedand issued periodically depending on the update rate for the controlloop, which is selected based on a maximum anticipated rate of change ofthe blood glucose level, an insulin delivery system minimum insulindosage, insulin sensitivity, a maximum and a minimum acceptable glucoseconcentration, or the like. The commands U_(PID) are used as inputs tothe post-controller lead-lag compensator 522.

In particular embodiments, the compensated commands (U_(COMP)) issuedfrom the post-controller lead-lag compensator 522 uses more than onevalue from the controller. In particular embodiments, post-controllerlead-lag compensator 522 uses the present command (U_(PID) ^(n)) and theprevious command (U_(PID) ^(n−1)) to calculate a compensated commandU_(COMP) per a compensation equation:U _(COMP) ^(n)=(1−γ)U _(COMP) ^(n−1) +U _(PID) ^(n)+(1−α)U _(PID)^(n−1), where:

U_(PID) ^(n) is the present command,

U_(PID) ^(n−1) is the previous command,

U_(COMP) ^(n−1) is the previous compensated control output,

α is the reciprocal lead time constant in min⁻¹, and

γ is the reciprocal lag time constant in min⁻¹.

This is a first forward difference equation. However, other forms can beused alternatively (e.g., first backward or bilinear), but all result ina compensated control output (U_(COMP)) that is comprised of a weightedhistory of both past PID outputs (U_(PID)), and past compensated outputs(U_(COMP)).

An alternative method of modifying the commands (U_(PID)) to compensatefor the insulin delivery delay and/or the insulin clearance can beperformed based on a weighted history of past insulin delivery. Bygiving the most recent delivery history more weight, the weightedhistory of the previous insulin delivered can then be subtracted fromthe present PID control output to yield a compensated control output.Expressed in Laplace domain this results in:

${U_{COMP} = {{P\; I\; D\mspace{14mu} E} - {\frac{\lambda}{s + \alpha}U_{COMP}}}},$where E is the Laplace transformed error signal (G−G_(B)), λ determineshow much the PID output is reduce in proportion to the weighted historyof past control outputs, and α is the reciprocal time constantdetermining how long a history is weighted (the preferred value of αwould be equal to the reciprocal dominant time constant or subcutaneousinsulin appearance, P₂). Solving the compensated signals as a functionof the error results in:

${\frac{U(s)}{E(s)} = {{P\; I\; D\frac{s + \alpha_{w}}{s + ( {\alpha + \lambda} )}} = {P\; I\; D\frac{s + \alpha_{w}}{s + \gamma}}}},$which is identical to the previously described lead-lag compensation.

In other alternative embodiments, additional previous command values maybe used. In still other alternative embodiments, the compensationequation compensates for both time constants P₂ and P₃.

In still more alternative embodiments, the controller gains are modifiedto include the effects of the post-controller lead/lag compensator sothat the post-controller lead/lag compensator is not needed to modifythe commands to account for the insulin delivery delay.

In particular embodiments, the insulin delivery system provides finiteinsulin doses into the body in response to commands from the controller.The smallest amount of insulin that the insulin delivery system candeliver is the minimum finite insulin dose. The controller may generatecommands for a dose of insulin to be delivered that is not a wholenumber multiple of the minimum finite insulin dose. Therefore, eithertoo much or too little insulin is delivered by the insulin deliverysystem in response to the commands. In particular alternativeembodiments, the post-controller lead-lag compensator truncates thecommand to the nearest whole number multiple of the minimum finiteinsulin dose and adds the remaining commanded volume of insulin to thenext command. In other alternative embodiments, a compensator rounds thecommand to the nearest whole number multiple of the minimum finiteinsulin dose. In still other alternative embodiments, other methods areused to compensate for the difference between the commands and thenearest whole number multiple of the minimum finite insulin dose. Inother embodiments, no compensation is needed.

Eliminating the Lead-Lag Compensator with Feedback of Predicted PlasmaInsulin

Yet in another alternative embodiment, the PID control commands may bemodified to emulate the effect of plasma insulin on a β-cell todetermine optimal insulin administration by feeding back a predictedplasma insulin based on the subcutaneous insulin infusion. The neteffect of such feedback is to replace an undesired dynamic with a moredesirable one and achieve a plasma insulin profile that a β-cell wouldachieve. This can be seen as follows (using Laplace transformedvariables). Assume the relation between glucose above basal (G−G_(B))and insulin delivery (ID) is described by a linear transfer functionID(s)=C(s)(G(s)−G_(B)), where C(s) may be, but is not necessarily,described by the PID controller transfer function. If the β-cell isusing peripheral insulin (I_(p)(s)) levels to suppress insulin secretionthe predicted rate of insulin delivery would be modified as:ID(s)=C(s)(G(s)−G_(B))−kI_(p)(s).

For portal insulin delivery the relation between ID(s) and plasmainsulin I_(P)(s) is known to be approximated by a single time delay:

${I_{p}(s)} = {\frac{k_{1}}{s + \alpha}I\;{{D(s)}.}}$Substituting I_(p)(s) value into the previous formula and making k largeresults in:

${{{I\;{D(s)}} = {\frac{{C(s)}( {{G(s)} - G_{B}} )}{1 + \frac{{kk}_{1}}{s + \alpha}} \approx {{C(s)}\frac{s + \alpha}{{kk}_{1}}( {{G(s)} - G_{B}} )}}};{1\;\;\frac{{kk}_{1}}{s + \alpha}}},$which would completely cancel the undesirable time constant 1/α. Inpractice a lower value of k would be used resulting in:

${{I\;{D(s)}} = {{{{C(s)}( {{G(s)} - G_{B}} )} - {\frac{{kk}_{1}}{s + \alpha}I\;{D(s)}}} = {{C(s)}\frac{s + \alpha}{s + \gamma}( {{G(s)} - G_{B}} )}}},$where γ=α+kk₁ (i.e., something greater than α). Thus, the effect for theβ-cell, of adding a plasma insulin feedback is to replace the portalinsulin delivery time constant (α) with a faster time constant (γ=α+kk₁;γ>α). In block diagram form:

$ {G - G_{B}}arrow{\begin{matrix}{{C(s)} \cdot \frac{s + \alpha}{s + \gamma}}\end{matrix}\;\overset{I\; D}{arrow}\;{\begin{matrix}\frac{k_{1}}{s + \alpha}\end{matrix}\;\overset{I_{p}}{arrow}}} $which is equivalent to:

$ {G - G_{B}}arrow{\begin{matrix}{{C(s)} \cdot \frac{1}{s + \gamma}}\end{matrix}\;\overset{I_{p}}{arrow}} $

To apply this mechanism to subcutaneous insulin delivery all that isneeded is the transfer function between sc insulin delivery and plasmainsulin. This transfer function is well approximated by a bi-exponentialtime course (bolus response) or:

$\frac{I_{p}(s)}{{ID}_{SC}(s)} = \frac{k_{2}}{( {s + \alpha_{1}} )( {s + \alpha_{2}} )}$${thus},\text{}\begin{matrix}{{{ID}(s)} = {{{C(s)}( {{G(s)} - G_{B}} )} - {\frac{{kk}_{2}}{( {s + \alpha_{1}} )( {s + \alpha_{2}} )}{{ID}(s)}}}} \\{= {{C(s)}\frac{1}{1 + \frac{{kk}_{2}}{( {s + \alpha_{1}} )( {s + \alpha_{2}} )}}( {{G(s)} - G_{B}} )}}\end{matrix}$in the limiting case as kk₂/(s+α₁)(s+α₂)>>1 this is approximately equalto

${{ID}(s)} = {{C(s)}\frac{( {s + \alpha_{1}} )( {s + \alpha_{2}} )}{{kk}_{2}}( {{G(s)} - G_{B}} )}$where again, the undesirable time constants associated with subcutaneousinsulin delivery have been eliminated. In practice they would just bereplaced with more desirable rate constants (i.e., faster timeconstants).

Correction of Hypoglycemic Excursion Around ˜200 Minutes (Wind-Down)

Previous modeling of β-cells using a PID controller gave excellentpredictability of the “first” and “second” phase insulin responsesduring prolonged periods of increased glucose appearance. However, ifthe periods of increased glucose appearance is followed by a rapiddecrease in glucose appearance, the PID controller would not be able tocorrectly predict the wind down of the insulin response to lower glucoselevels. FIG. 41B illustrates the insulin response to the blood glucoselevel of FIG. 41A based on the clinical data (shown as data points), thePID modeling (shown as a solid line), and correction of the PID for thehypoglycemic excursion (shown as a dashed line).

In preferred embodiments, the hypoglycemic excursion is corrected bymodifying the PID controller to a PD control with Adaptive ProportionalGain (or Bilinear PID controller), which is modified form of theoriginal PID equations. As described previously, the discrete PIDalgorithm is as follows:

Proportional Component Response:P _(con) ^(n) =K _(P)(SG_(f) ^(n) −G _(sp)),

Integral Component Response:I _(con) ^(n) =I _(con) ^(n−1) +K _(I)(SG_(f) ^(n) −G _(sp));I _(con) ⁰=I _(b), and

Derivative Component Response:D _(con) ^(n) =K _(D) dGdt _(f) ^(n),where K_(P), K_(I) and K_(D) are the proportional, integral, andderivative gain coefficients, SG_(f) and dGdt_(f) are the filteredsensor glucose and derivative respectively, and the superscript n refersto discrete time.

In the Bilinear PID controller, the proportional gain K_(P) is based onthe integrated error term. The magnitude of each component'scontribution to the insulin response is described by the followingequations:P _(con) ^(n) =K _(P) ^(n)(SG_(f) ^(n)−INT)D _(con) ^(n) =K _(D) dGdt _(f) ^(n)K _(P) ^(n) =K _(P) ^(n−1) +K _(I)(SG_(f) ^(n) −G _(sp)), where K _(P) ⁰=K _(P0)Where the proportional gain now integrates at rate K_(I) (initial valueK_(P0)) and the proportional component is related to an intercept value(INT) where (INT<G_(sp)). The modified formulation can be seen to fitthe hypoglycemic glucose excursion without systematic error as theadaptive PD line shown as a dashed line in FIG. 39.

In additional embodiments, the Bilinear PID controller can alsoincorporate an integrator leak by modifying the formula to multiply theprevious K_(P) with a value such as α as follows:K _(P) ^(n) =αK _(P) ^(n−1) +K _(I)(SG_(f) ^(n) −G _(sp)), where α≈0.99

An alternative method of correcting the hypoglycemic glucose excursioncan be performed by integrator clip into the PID control. PIDcontrollers generally have integrator-reset rules that prevent excessive“winding” and such a rule can be used to correct the hypoglycemicglucose excursion. For example, the integrator can be clipped asfollows:If(SG≤60 mg/dl AND I _(con) ^(n−1) >K _(P)(SP−60)) then I _(con) ^(n−1)=K _(P)(SP−60)This equation resets the integrator such that if the sensor glucosefalls below 60 mg/dl the insulin delivery is zero for all stable orfalling sensor glucose signals. The clipping limit represents anabsolute threshold, similar to the human counter regulatory response.

However, other approaches that may emulate the β-cell more accuratelyinclude the use of piecewise continuous functions. For example, thefollowing function allows for progressive clipping to be tuned:

${\gamma({SG})} = {\gamma_{0} + {( {1 - \gamma_{0}} )\lbrack \frac{T_{1 - {SG}}}{T_{1} - 60} \rbrack}}$if  (SG ≤ T₁  mg/dl  AND  I_(con)^(n − 1) > γ K_(p)(SP − 60))  thenI_(con)^(n − 1) = γ K_(P)(SP − 60)This equation introduces two additional tuning parameters (γ₀ and T₁)and starts to check the integrator output at a higher threshold. Forexample, if γ₀=5 and T₁=100 mg/dl, the integrator output would beclipped to 4 K_(P)60 if glucose fell to 90 mg/dl, 3 K_(P)60 if glucosefell to 80 mg/dl and so forth until glucose reached 60 where it would beclipped at K_(P)60. Other functions than that proposed in the aboveequation (e.g. functions based on the rate of fall of glucose, orpercent decrease in I_(con)) may alternatively be used.

System Configurations

The following sections provide exemplary, but not limiting,illustrations of components that can be utilized with the controllerdescribed above. Various changes in components, layout of variouscomponents, combinations of elements, or the like may be made withoutdeparting from the scope of the embodiments of the invention.

Before it is provided as an input to the controller 12, the sensorsignal 16 is generally subjected to signal conditioning such aspre-filtering, filtering, calibrating, or the like. Components such as apre-filter, one or more filters, a calibrator and the controller 12 maybe split up or physically located together, and may be included with atelemetered characteristic monitor transmitter 30, the infusion device34, or a supplemental device. In preferred embodiments, the pre-filter,filters and the calibrator are included as part of the telemeteredcharacteristic monitor transmitter 30, and the controller 12 is includedwith the infusion device 34, as shown in FIG. 8B. In alternativeembodiments, the pre-filter is included with the telemeteredcharacteristic monitor transmitter 30 and the filter and calibrator areincluded with the controller 12 in the infusion device, as shown in FIG.8C. In other alternative embodiments, the pre-filter may be includedwith the telemetered characteristic monitor transmitter 30, while thefilter and calibrator are included in the supplemental device 41, andthe controller is included in the infusion device, as shown in FIG. 8D.To illustrate the various embodiments in another way, FIG. 9 shows atable of the groupings of components (pre-filter, filters, calibrator,and controller) in various devices (telemetered characteristic monitortransmitter, supplemental device, and infusion device) from FIGS. 8A-D.In other alternative embodiments, a supplemental device contains some of(or all of) the components.

In preferred embodiments, the sensor system generates a message thatincludes information based on the sensor signal such as digital sensorvalues, pre-filtered digital sensor values, filtered digital sensorvalues, calibrated digital sensor values, commands, or the like. Themessage may include other types of information as well such as a serialnumber, an ID code, a check value, values for other sensed parameters,diagnostic signals, other signals, or the like. In particularembodiments, the digital sensor values Dsig may be filtered in thetelemetered characteristic monitor transmitter 30, and then the filtereddigital sensor values may be included in the message sent to theinfusion device 34 where the filtered digital sensor values arecalibrated and used in the controller. In other embodiments, the digitalsensor values Dsig may be filtered and calibrated before being sent tothe controller 12 in the infusion device 34. Alternatively, the digitalsensor values Dsig may be filtered, and calibrated and used in thecontroller to generate commands 22 that are then sent from thetelemetered characteristic monitor transmitter 30 to the infusion device34.

In further embodiments, additional optional components, such as apost-calibration filter, a display, a recorder, and a blood glucosemeter may be included in the devices with any of the other components orthey may stand-alone. Generally, if a blood glucose meter is built intoone of the devices, it will be co-located in the device that containsthe calibrator. In alternative embodiments, one or more of thecomponents are not used.

In preferred embodiments, RF telemetry is used to communicate betweendevices, such as the telemetered characteristic monitor transmitter 30and the infusion device 34, which contain groups of components. Inalternative embodiments, other communication mediums may be employedbetween devices such as wires, cables, IR signals, laser signals, fiberoptics, ultrasonic signals, or the like.

Filtering

In preferred embodiments, the digital sensor values Dsig and/or thederivative of the digital sensor values are processed, filtered,modified, analyzed, smoothed, combined, averaged, clipped, scaled,calibrated, or the like, to minimize the effects of anomalous datapoints before they are provided as an input to the controller. Inparticular embodiments, the digital sensor values Dsig are passedthrough a pre-filter 400 and then a filter 402 before they are passed tothe transmitter 70, as shown in FIG. 16. The filters are used to detectand minimize the effects of anomalous digital sensor values Dsig. Somecauses of anomalous digital sensor values Dsig may include temporarysignal transients caused by sensor separation from the subcutaneoustissue, sensor noise, power supply noise, temporary disconnects orshorts, and the like. In particular embodiments, each individual digitalsensor value Dsig is compared to maximum and minimum value-thresholds.In other particular embodiments, the differences between consecutivepairs of digital sensor values Dsig are compared withrate-of-change-thresholds for increasing or decreasing values.

Pre-Filter

In particular embodiments, the pre-filter 400 uses fuzzy logic todetermine i-f individual digital sensor values Dsig need to be adjusted.The pre-filter 400 uses a subset of a group of digital sensor valuesDsig to calculate a parameter and then uses the parameter to determineif individual digital sensor values Dsig need to be adjusted incomparison to the group as a whole. For example, the average of a subsetof a group of digital sensor values Dsig may be calculated, and thennoise thresholds may be placed above and below the average. Thenindividual digital sensor values Dsig within the group are compared tonoise thresholds and eliminated or modified if they are outside of thenoise thresholds.

A more detailed example is provided below to more clearly illustrate,but not limit, an embodiment of a pre-filter. A group of eight digitalsensor values Dsig are shown in FIG. 17 including a most recentlysampled value, labeled L, sampled from the analog sensor signal Isig attime i, and the seven previous values K, H, G, F, E, D, and C sampled attimes (i−1) through (i−7). An average value is calculated using the fourtemporally middle values in the group, H, G, F, and E sampled at times(i−2) through (i−5). The calculated average value is represented as adashed/dotted average line 404. A high noise threshold 406 isestablished at 100% above the average line 404. In other words, themagnitude of the high noise threshold 406 is two times the magnitude ofthe average line 404. A negative noise threshold 408 is established at50% below the average line 404. In other words, the magnitude of thenegative noise threshold 408 is one half of the magnitude of the averageline 404. The individual magnitudes of each of the eight values, L, K,H, G, F, E, D, and C are compared to the high and negative noisethresholds 406 and 408. If a value is above the high noise threshold 406or below the negative noise threshold 408 then the value is consideredanomalous and the anomalous value is replaced with the magnitude of theaverage line 404. In the example shown in FIG. 17, the value K is abovethe high noise threshold 406 so it is replaced with the average value M.Also, the value D is below the negative noise threshold 408 so it isreplaced with the average value N. In this way noisy signal spikes arereduced. Therefore, in the example, values L, K, H, G, F, E, D, and Care inputs to the pre-filter 400 and values L, M, H, G, F, E, N, and Care outputs from the pre-filter 400. In alternative embodiments, othernoise threshold levels (or percentages) may be used. In otheralternative embodiments, values outside of the thresholds may bereplaced with values other than the average value, such as the previousvalue, the value of the closest threshold, a value calculated byextrapolating a trend line through previous data, a value that iscalculated by interpolation between other values that are inside thethresholds, or the like.

In preferred embodiments, when any of a group's values are outside ofthe noise thresholds 406 or 408 then a warning flag is set. If one tothree values are outside of the noise thresholds 406 or 408, a “noise”flag is set. If more than three values are outside of the noisethresholds 406 or 408, a “discard” flag is set which indicates that thewhole group of values should be ignored and not used. In alternativeembodiments, more or less values need be outside of the thresholds 406or 408 to trigger the “noise” flag or the “discard” flag.

In preferred embodiments, each digital sensor value Dsig is checked forsaturation and disconnection. To continue with the example of FIG. 17,each individual value is compared to a saturation threshold 410. If avalue is equal to or above the saturation threshold 410 then a“saturation” flag is set. In particular embodiments, when the“saturation” flag is set, a warning is provided to the user that thesensor 26 may need calibration or replacement. In further particularembodiments, if an individual digital sensor value Dsig is at or abovethe saturation threshold 410, the individual digital sensor value Dsigmay be ignored, changed to a value equal to the average line 404, or theentire group of values associated with the individual digital sensorvalue Dsig may be ignored. In preferred embodiments, the saturationthreshold 410 is set at about 16% below the maximum value of the rangeof digital sensor values that may be generated. In preferredembodiments, the maximum digital sensor value represents a glucoseconcentration greater than 150 mg/dl. In alternative embodiments, themaximum digital sensor value may represent larger or smaller a glucoseconcentrations depending on the range of expected glucose concentrationsto be measured, the sensor accuracy, the sensor system resolution neededfor closed loop control, or the like. The full range of values is thedifference between the maximum and the minimum digital sensor value thatmay be generated. Higher or lower saturation threshold levels may beused depending on an expected signal range of the sensor, sensor noise,sensor gains, or the like.

Similarly, in preferred embodiments, if a digital signal value Dsig isbelow a disconnect threshold 412, then a “disconnect” flag is setindicating to a user that the sensor is not properly connected to thepower supply and that the power supply or sensor may need replacement orrecalibration. In further particular embodiments, if a digital sensorvalue Dsig is below the disconnect threshold 412, the individual valuemay be ignored, changed to a value equal to the average line 404, or theentire group of values associated with the individual digital sensorvalue Dsig may be ignored. In preferred embodiments, the disconnectthreshold 410 is set at about 20% of the full range of values. Higher orlower disconnect threshold levels may be used depending on an expectedsignal range of the sensor, sensor system noise, sensor gains, or thelike.

In alternative embodiments, other methods are used to pre-filter thedigital sensor values Dsig such as rate-of-change thresholds,rate-of-change squared thresholds, noise thresholds about a leastsquares fit line rather than about the average of a subset of a group'svalues, higher or lower noise threshold lines, or the like.

Noise Filter

After the digital sensor values Dsig are evaluated, and if necessary,modified by the pre-filter 400, the digital sensor values Dsig arepassed to the filter 402. The filter 402 may be used to reduce noise inparticular frequency bands. Generally the body's blood glucose level 18changes relatively slowly compared to a rate at which digital sensorvalues Dsig are collected. Therefore, high frequency signal componentsare typically noise, and a low pass filter may be used to improve thesignal to noise ratio.

In preferred embodiments, the filter 402 is a finite impulse response(FIR) filter used to reduce noise. In particular embodiments, the FIRfilter is a 7th order filter tuned with a pass band for frequencies fromzero to 3 cycles per hour (c/hr) and a stop band for frequencies greaterthan about 6 c/hr, as shown in an example frequency response curve 414in FIG. 18. However, typically FIR filters tuned with a pass band forfrequencies from zero up to between about 2 c/hr and 5 c/hr and a stopband beginning at 1.2 to three times the selected pass band frequencywill sufficiently reduce noise while passing the sensor signal. Inparticular embodiments, FIR filters tuned with a pass band forfrequencies from zero up to between about 2 c/hr and 10 c/hr and a stopband beginning at 1.2 to three times the selected pass band frequencywill sufficiently reduce noise. In the 7th order filter, uniqueweighting factors are applied to each of eight digital sensor valuesDsig. The digital sensor values Dsig include the most recently sampledvalue and the seven previous values. The effects of a low pass filter ona digital sensor values collected at one minute intervals is shown inFIGS. 19A and B. An unfiltered sensor signal curve 416 of digital sensorvalues is contrasted with a curve of the same signal after the effectsof a 7th order FIR filter 418. The filtered signal curve 418 is delayedand the peaks are smoother compared to the unfiltered sensor signalcurve 416. In other particular embodiments, higher or lower orderfilters may be used. In still other particular embodiments, filterweighting coefficients may be applied to digital sensor values Dsigcollected at time intervals shorter or longer than one minute dependingon the desired sensor sample rate based on the body's physiology, thecomputational capabilities of the telemetered characteristic monitortransmitter 30, the sensor's response time, or the like. In alternativeembodiments, filters with other frequency responses may be used toeliminate other noise frequencies depending on the type of sensor, noisefrom the power supply or other electronics, the sensor's interactionwith the body, the effects of body motion on the sensor signal, or thelike. In still other alternative embodiments, the filter is an infiniteimpulse response (IIR) filter.

In alternative embodiments, other methods are used to pre-filter thedigital sensor values Dsig such as rate-of-change thresholds,rate-of-change squared thresholds, noise thresholds about a leastsquares fit line rather than about the average of a subset of a group'svalues, higher or lower noise threshold lines, or the like.

Delay Compensation Filter

Aside from noise reduction, a filter may be used to compensate for timedelays. Ideally, a sensor would provide a real time, noise-freemeasurement of a parameter that a control system is intended to control,such as a blood glucose measurement. However, realistically there arephysiological, chemical, electrical, and algorithmic sources of timedelays that cause the sensor measurement to lag behind the present valueof blood glucose.

A physiological delay 422 is due to the time required for glucose tomove between blood plasma 420 and interstitial fluid (ISF). The delay isrepresented by the circled double headed arrow 422 in FIG. 20.Generally, as discussed above, the sensor 26 is inserted into thesubcutaneous tissue 44 of the body 20 and the electrodes 42 near the tipof the sensor 40 are in contact with interstitial fluid (ISF). But thedesired parameter to be measured is the concentration of blood glucose.Glucose is carried throughout the body in blood plasma 420. Through theprocess of diffusion, glucose moves from the blood plasma 420 into theISF of the subcutaneous tissue 44 and vice versa. As the blood glucoselevel 18 changes so does the glucose level in the ISF. But the glucoselevel in the ISF lags behind the blood glucose level 18 due to the timerequired for the body to achieve glucose concentration equilibriumbetween the blood plasma 420 and the ISF. Studies show the glucose lagtimes between blood plasma 420 and ISF vary between 0 to 30 minutes.Some parameters that may affect the glucose lag time between bloodplasma 420 and ISF are the individual's metabolism, the current bloodglucose level, whether the glucose level is rising, or falling, or thelike.

A chemical reaction delay 424 is introduced by the sensor response time,represented by the circle 424 surrounding the tip of the sensor 26 inFIG. 20. The sensor electrodes 42 are coated with protective membranesthat keep the electrodes 42 wetted with ISF, attenuate the glucoseconcentration, and reduce glucose concentration fluctuations on theelectrode surface. As glucose levels change, the protective membranesslow the rate of glucose exchange between the ISF and the electrodesurface. In addition, there is a chemical reaction delay simply due tothe reaction time for glucose to react with glucose oxidase GOX togenerate hydrogen peroxide, and the reaction time for a secondaryreaction, the reduction of hydrogen peroxide to water, oxygen and freeelectrons.

There is also a processing delay as the analog sensor signal Isig isconverted to digital sensor values Dsig. In preferred embodiments, theanalog sensor signal Isig is integrated over one-minute intervals andthen converted to a number of counts. In essence an A/D conversion timeresults in an average delay of 30 seconds. In particular embodiments,the one-minute values are averaged into 5-minute values before they aresent to the controller. The resulting average delay is two and one halfminutes. In alternative embodiments, longer or shorter integration timesare used resulting in longer or shorter delay times. In otherembodiments the analog sensor signal current Isig is continuouslyconverted to an analog voltage Vsig and a A/D converter samples thevoltage Vsig every 10 seconds. Then six 10-second values arepre-filtered and averaged to create a one-minute value. Finally, five1-minute values are filtered and then averaged creating a five-minutevalue resulting in an average delay of two and one half minutes. Otherembodiments use other electrical components or other sampling rates andresult in other delay periods.

Filters also introduce a delay due to the time required to acquire asufficient number of digital sensor values Dsig to operate the filter.Higher order filters, by definition, require more digital sensor valuesDsig. Aside from the most recent digital sensor value Dsig, FIR filtersuse a number of previous values equal to the order of the filter. Forexample, a 7th order filter uses 8 digital sensor values Dsig. There isa time interval between each digital sensor value Dsig. To continue withthe example, if the time interval between digital sensor values Dsig isone minute, then the oldest digital sensor value Dsig used in a 7thorder FIR filter would be seven minutes old. Therefore, the average timedelay for all of the values used in the filter is three and a halfminutes. However, if the weighting factors associated with each of thevalues are not equal then the time delay may be longer or shorter thanthree and one half minutes depending on the effects of the coefficients.

Preferred embodiments of the invention include a FIR filter thatcompensates for both the various time delays, of up to about 30 minutesas discussed above, and high frequency noise, greater than about 10 c/hralso discussed above. Particular embodiments employ a 7th order Weinertype FIR filter. The coefficients for the filter are selected to correctfor time lags while simultaneously reducing high frequency noise. Anexample of a frequency response curve 426 is shown in FIG. 21. Theexample frequency response curve 416 is generated for a Weiner filterwith a pass band for frequencies from zero up to about 8 c/hr and a stopband for frequencies greater than about 15 c/hr for a sensor with asensitivity of about 20 μA/100 mg/dl. A study conducted with sensors indogs demonstrates that a FIR filter may be used to compensate for timedelays. During the study a filter was used to compensate for a timedelay of about 12 minutes. The results, presented in FIG. 22, show dots428 representing actual blood plasma glucose levels measured with ablood glucose meter, a broken line 430 representing sensor measurementswithout delay compensation, and a solid line 432 representing sensormeasurements with delay compensation. The sensor in the test wasabnormally low in sensitivity. Studies with average sensitivity sensorsin humans are indicating a time delay of about 3 to 10 minutes is morenormal. Other filter coefficients and other orders of filters may beused to compensate for the time delay and/or noise.

In alternative embodiments, other types of filters may be used as longas they remove a sufficient portion of the noise from the sensor signal.In other alternative embodiments, no time compensation is used if therate of change in the blood glucose level is slow compared to the timedelay. For example, a five-minute delay between blood plasma glucose anda sensor measurement does not have to be corrected for a closed loopglucose control system to function.

Derivative Filter

Further embodiments may include a filter to remove noise from thederivative of the sensor signal before the controller uses it. Aderivative is taken from the digital sensor values Dsig, which resultsin digital derivative sensor values (dDsig/dt). The digital derivativesensor values dDsig/dt are passed through a FIR filter. In particularembodiments, the derivative filter is at least a 7th order FIR filtertuned to remove high frequency noise. In alternative embodiments, higheror lower order filters may be used and the filters may be tuned toremove various frequencies of noise. In other alternative embodiments, aderivative is taken from the glucose level error G_(E) values and thenpassed through a derivative filter 526, as shown in FIG. 37. In furtheralternative embodiments, a derivative is taken of an analog sensorsignal Isig and a hardware filter is used to remove noise.

Calibration

In preferred embodiments, after filtering, the digital sensor valuesDsig are calibrated with respect to one or more glucose referencevalues. The glucose reference values are entered into the calibrator andcompared to the digital sensor values Dsig. The calibrator applies acalibration algorithm to convert the digital sensor values Dsig, whichare typically in counts into blood glucose values. In particularembodiments, the calibration method is of the type described in U.S.patent application Ser. No. 09/511,580, filed on Feb. 23, 2000 andissued on Jul. 23, 2002 as U.S. Pat. No. 6,424,847, entitled “GLUCOSEMONITOR CALIBRATION METHODS”, which is incorporated by reference herein.In particular embodiments, the calibrator is included as part of theinfusion device 34 and the glucose reference values are entered by theuser into the infusion device 34. In other embodiments, the glucosereference values are entered into the telemetered characteristic monitortransmitter 30 and the calibrator calibrates the digital sensor valuesDsig and transmits calibrated digital sensor values to the infusiondevice 34. In further embodiments, the glucose reference values areentered into a supplemental device where the calibration is executed. Inalternative embodiments, a blood glucose meter is in communication withthe infusion device 34, telemetered characteristic monitor transmitter30 or supplemental device so that glucose reference values may betransmitted directly into the device that the blood glucose meter is incommunication with. In additional alternative embodiments, the bloodglucose meter is part of the infusion device 34, telemeteredcharacteristic monitor transmitter 30 or supplemental device such asthat shown in U.S. patent application Ser. No. 09/334,996, filed on Jun.17, 1999, entitled “CHARACTERISTIC MONITOR WITH A CHARACTERISTIC METERAND METHOD OF USING THE SAME”, which is incorporated by referenceherein.

In preferred embodiments, to obtain blood glucose reference values, oneor more blood samples are extracted from the body 20, and a common,over-the-counter, blood glucose meter is used to measure the bloodplasma glucose concentration of the samples. Then a digital sensor valueDsig is compared to the blood glucose measurement from the meter and amathematical correction is applied to convert the digital sensor valuesDsig to blood glucose values. In alternative embodiments, a solution ofa known glucose concentration is introduced into the subcutaneous tissuesurrounding the sensor 26 by using methods and apparatus such asdescribed in U.S. patent application Ser. No. 09/395,530, filed on Sep.14, 1999 and issued on Jul. 3, 2001 as U.S. Pat. No. 6,254,586, entitled“METHOD AND KIT FOR SUPPLYING A FLUID TO A SUBCUTANEOUS PLACEMENT SITE”,which is incorporated by reference herein, or by using injection,infusion, jet pressure, introduction through a lumen, or the like. Adigital sensor value Dsig is collected while the sensor 26 is bathed inthe solution of known glucose concentration. A mathematical formula suchas a factor, an offset, an equation, or the like, is derived to convertthe digital sensor value Dsig to the known glucose concentration. Themathematical formula is then applied to subsequent digital sensorsvalues Dsig to obtain blood glucose values. In alternative embodiments,the digital sensor values Dsig are calibrated before filtering. Inadditional alternative embodiments, the digital sensor values Dsig arecalibrated after pre-filtering and before filtering. In otheralternative embodiments, the sensors are calibrated before they are usedin the body or do not require calibration at all.

Sensor Signal Processing Systems

Before filtering and calibrating, generally the sensor signal isprocessed to convert the sensor signal from a raw form into a formacceptable for use in the filters and/or calibrator. In preferredembodiments, as shown in FIG. 10, an analog sensor signal Isig isdigitally quantified through an A/D converter 68 resulting in digitalsensor values Dsig that are transmitted by a transmitter 70 from thetelemetered characteristic monitor transmitter 30 to another device. Inparticular embodiments, the analog sensor signal Isig is an analogcurrent value that is converted to a digital sensor value Dsig in theform of a digital frequency measurement, as shown in FIG. 11 (a). Thegeneral circuit includes an integrator 72, a comparator 74, a counter76, a buffer 78, a clock 80 and the transmitter 70. The integrator 72generates a substantially ramped voltage signal (A), and theinstantaneous slope of the ramped voltage signal is proportional to themagnitude of the instantaneous analog sensor signal Isig. The comparator74 converts the ramped voltage signal (A) from the integrator 72 intosquare wave pulses (B). Each pulse from the comparator 74 increments thecounter 76 and also resets the integrator 72. The clock 80 periodicallytriggers the buffer 78 to store the present value from the counter 76and then resets the counter 76. The values stored in the buffer 78 arethe digital sensor values Dsig. The clock 80 may also periodicallysignal the transmitter 70 to send a value from the buffer 78. Inpreferred embodiments, the clock period is one minute. However, inalternative embodiments, the clock period may be adjusted based on howoften measurements are needed, sensor signal noise, sensor sensitivity,required measurement resolution, the type of signal to be transmitted,or the like. In alternative embodiments, a buffer is not used.

A/D Converters

Various A/D converter designs may be used in embodiments of the presentinvention. The following examples are illustrative, and not limiting,since other A/D converters may be used.

I to F (Current to Frequency (Counts)), Single Capacitor, QuickDischarge

In preferred embodiments, the integrator 72 consists of a first Op-Amp92 and a capacitor 82, shown in FIG. 12. The integrator 72 sums theanalog sensor signal Isig current by charging the capacitor 82 until thecapacitor voltage (A′) achieves a high reference voltage (VrefH). Thecapacitor voltage (A′) is measured at the output of the first Op-Amp 92.A second Op-Amp 94 is used as a comparator. When the capacitor voltage(A′) reaches VrefH, the comparator output (B′) changes from low to high.The high comparator output (B′) closes a reset switch 84 that dischargesthe capacitor 82 through a voltage source (V+). The high comparatoroutput (B′) also triggers a reference voltage switch 88 to close, whilesubstantially simultaneously an inverter 86 inverts the comparatoroutput (B′). And the inverter output (C′) triggers a reference voltageswitch 90 to open. The result is that the reference voltage of thecomparator is changed from VrefH to the low reference voltage (VrefL).

When the capacitor voltage (A′) is discharged to VrefL, the comparatoroutput (B′) returns to low, thus forming a pulse. The low comparatoroutput (B′) opens the reset switch 84 allowing the capacitor 82 to begincharging again.

Virtually simultaneously, the low comparator output (B′) also triggersthe reference voltage switch 88 to open and the inverter output (C′)triggers reference voltage switch 90 to close resulting in changing thecomparator reference voltage from VrefL back to VrefH.

I to F, Single Reversible Capacitor

In alternative embodiments, two or more integrator switches are used tocontrol the polarity of one or more capacitors. A particular embodimentis shown in FIG. 13. Generally, only one of the two integrator-switches110 and 112 is closed and the other integrator switch is open. When thefirst integrator switch 110 is closed, the second integrator switch 112is open and an integrator Op-Amp 114 sums the analog sensor signal Isigcurrent by charging a capacitor 116 until the capacitor voltage (A″)achieves a high reference voltage (VrefH). The comparator 120 comparesthe integrator output (A″) to the reference voltage VrefH. And when thecapacitor voltage (A″) reaches VrefH, the comparator output (B″) shiftsfrom low to high, initiating a pulse.

The high comparator output (B″) pulse causes the capacitor polarity toreverse using the following method. The high comparator output (B″)triggers the second integrator switch 112 to close while virtuallysimultaneously the inverter 118 inverts the comparator output (B″). Andthe low inverter output (C″) pulse triggers the first integrator switch110 to open. Once the capacitor's polarity is reversed, the capacitor116 discharges at a rate proportional to the analog sensor signal Isig.The high comparator output (B″) pulse also triggers the referencevoltage of the comparator to change form VrefH the low reference voltage(VrefL). When the capacitor voltage (A″) is discharged to VrefL, thecomparator output (B″) returns to low. The low comparator output (B″)opens the second integrator switch 112 and virtually simultaneously thehigh inverter output (C″) closes the first integrator switch 110allowing the capacitor 116 to begin charging again. The low comparatoroutput (B″) also triggers the comparator reference voltage to changefrom VrefL back to VrefH.

An advantage of this embodiment is that sensor signal errors, which maybe created due to capacitor discharge time, are reduced since themagnitude of the analog sensor signal Isig drives both the charging andthe discharging rates of the capacitor 116.

I to F, Dual Capacitor

In further alternative embodiments, more than one capacitor is used suchthat as one capacitor is charging, at a rate proportional to themagnitude of the analog sensor signal Isig, another capacitor isdischarging. An example of this embodiment is shown in FIG. 14. A seriesof three switches are used for each capacitor. A first group of switches210 is controlled by a latch voltage C′″, and a second group of switches212 are controlled by voltage D′″, which is the inverse of C′″.Substantially, only one group of switches is closed at a time. When thefirst group of switches 210 is closed, the voltage across a firstcapacitor 216 increases at a rate proportional to the analog sensorsignal Isig until the integrator voltage (A′″) at the output of Op-Amp214 achieves a reference voltage (Vref). At the same time one of theswitches shorts the circuit across a second capacitor 222 causing it todischarge. A comparator 220 compares the integrator output (A′″) to thereference voltage Vref And when the integrator output (A′″) reachesVref, the comparator output (B′″) generates a pulse. The comparatoroutput pulse increments a counter 76, and triggers the latch outputvoltage C′″ from a latch 221 to toggle from a low voltage to a highvoltage. The change in the latch voltage C′″ causes the second group ofswitches 212 to close and the first group of switches 210 to open. Oneof the switches from the second group of switches 212 shorts the circuitacross the first capacitor 216 causing it to discharge. At the same timethe voltage across the second capacitor 222 increases at a rateproportional to the analog sensor signal Isig until the integratorvoltage (A′″) at the output of Op-Amp 214 achieves a reference voltage(Vref). Again, the comparator 220 compares the integrator output (A′″)to the reference voltage Vref. And when the integrator output (A′″)reaches Vref, the comparator output (B′″) generates a pulse. Thecomparator output pulse increments the counter 76, and triggers thelatch output voltage C′″ to toggle from a high voltage to a low voltage,which causes the switches to return to their initial position with thefirst group of switches 210 closed and the second group of switches 212to open.

In summary, as the blood glucose level 18 increases, the analog sensorsignal Isig increases, which causes the voltage coming out of theintegrator 72 to ramp up faster to the high reference voltage VrefH,which causes the comparator 74 to generate pulses more often, which addscounts to the counter 76 faster. Therefore, higher blood glucose levelsgenerate more counts per minute.

The charge storage capacity for the capacitors used in the integrator72, and the reference voltages VrefH, and VrefL are selected such thatthe count resolution for counts collected in a one-minute period at aglucose level of 200 mg/dl represents a blood glucose measurement errorof less than 1 mg/dl. In particular embodiments, VrefH is 1.1 volts andVrefL is 0.1 volts. Higher or lower reference voltages may be selectedbased on the magnitude of the analog sensor signal Isig, the capacity ofthe capacitors, and the desired measurement resolution. The sourcevoltage V+ is set to a voltage sufficiently high to discharge one ormore capacitors quickly enough that the discharge times do notsignificantly reduce the number of counts per minute at a blood glucoselevel of 200 mg/dl.

Pulse Duration Output Feature

In preferred embodiments, the transmitter 70 transmits the digitalsensor values Dsig from the buffer 78 whenever triggered by the clock80. However, in particular embodiments, the user or another individualmay use a selector 96 to choose other outputs to be transmitted from thetransmitter 70, as shown in FIG. 11B. In preferred embodiments, theselector 96 is in the form of a menu displayed on a screen that isaccessed by the user or another individual by using buttons on thesurface of the telemetered characteristic monitor transmitter 30. Inother embodiments, a dial selector, dedicated buttons, a touch screen, asignal transmitted to the telemetered characteristic monitor transmitter30, or the like, may be used. Signals that may be selected to betransmitted, other than the digital sensor values Dsig, include, but arenot limited to, a single pulse duration, digital sensor values beforepre-filtering, digital sensor values after pre-filtering but beforefiltering, digital sensor values after filtering, or the like.

In particular embodiments, a pulse duration counter 98 counts clockpulses from a pulse duration clock 100 until the pulse duration counter98 is reset by a rising or falling edge of a pulse from the comparator74, as shown in FIG. 11B. The accumulated count at the time that thepulse duration counter 98 is reset represents the pulse duration for aportion of a single pulse from the comparator 74. The accumulated countfrom the pulse duration counter 98 is stored in the single pulse buffer102 when triggered by the reset signal. When an individual selects thesingle pulse output, the transmitter 70 transmits the values from thesingle pulse buffer 102. The pulse duration clock 100 period must besufficiently shorter than the period between individual pulse edges fromthe comparator 74 given a high analog sensor signal Isig to havesufficient resolution to quantify different pulse durations from thecomparator 74.

I to V (Current to Voltage), Voltage A/D

Alternative methods may be used to convert the analog sensor signal Isigfrom an analog current signal to a digital voltage signal. The analogsensor signal Isig is converted to an analog voltage Vsig using an OpAmp 302 and a resistor 304, as shown in FIG. 15. And then periodically aclock 308 triggers an A/D converter 306 to take a sample value from theanalog voltage Vsig and convert it to a digital signal representing themagnitude of the voltage. The output values of the A/D converter 306 aredigital sensor values Dsig. The digital sensor values Dsig are sent to abuffer 310 and then to a transmitter 312. In particular embodiments, theresistor 304 may be adjusted to scale the Vsig to use a significantportion of the range of the voltage A/D converter 306 depending on thesensor sensitivity, the maximum glucose concentration to be measured,the desired resolution from the voltage A/D converter 306, or the like.

In alternative embodiments, a buffer 310 is not needed and the digitalsensor values Dsig are sent from the A/D converter 306 directly to thetransmitter 312. In other alternative embodiments, the digital sensorvalues Dsig are processed, filtered, modified, analyzed, smoothed,combined, averaged, clipped, scaled, calibrated, or the like, beforebeing sent to the transmitter 312. In preferred embodiments, the clock308 triggers a measurement every 10 seconds. In alternative embodiments,the clock 308 runs faster or slower triggering measurements more or lessfrequently depending on how quickly the blood glucose level can change,the sensor sensitivity, how often new measurements are needed to controlthe delivery system 14, or the like.

Finally, in other alternative embodiments, other sensor signals fromother types of sensors, as discussed in the section “Sensor and SensorSet” below, are converted to digital sensor values Dsig if necessarybefore transmitting the digital sensor values Dsig to another device.

Additional Controller Inputs

Generally, the proportional plus, integral plus, derivative (PID)insulin response controller uses only glucose (digital sensor valuesDsig) as an input. Conversely, in a normally glucose tolerant humanbody, healthy β-cells benefit from additional inputs such as neuralstimulation, gut hormone stimulation, changes in free fatty acid (FFA)and protein stimulation etc. Thus in other alternative embodiments, thePID controller, as discussed above, can be augmented with one or moreadditional inputs. In particular alternative embodiments, the user maymanually input supplemental information such as a start of a meal, ananticipated carbohydrate content of the meal, a start of a sleep cycle,an anticipated sleep duration, a start of an exercise period, ananticipated exercise duration, an exercise intensity estimation, or thelike. Then, a model predictive control feature assists the controller touse the supplemental information to anticipate changes in glucoseconcentration and modify the output commands accordingly. For example,in a NGT individual, neural stimulation triggers the β-cells to begin tosecrete insulin into the blood stream before a meal begins, which iswell before the blood glucose concentration begins to rise. So, inalternative embodiments, the user can tell the controller that a meal isbeginning and the controller will begin to secrete insulin inanticipation of the meal.

In other alternative embodiments, the user or another individual maymanually override the control system or select a different controlleralgorithm. For instance, in particular alternative embodiments, anindividual may select to normalize to a basal glucose level immediately,and instead of using the β-cell emulating PID controller anothercontroller would take over such as a PID controller with differentgains, a PD controller for rapid glucose adjustment, or the like.Additional alternative embodiments allow an individual to turn off theintegral component of the PID controller once the glucose level isnormalized and no meals are anticipated. In other particular alternativeembodiments, the user may select to turn off the controller entirely,therefore disengaging the closed loop system. Once the closed loopsystem is not controlling insulin dosing, the user may program theinfusion device with a basal rate, variable basal rates, boluses, or thelike, or the user may manually enter each individual dosage when it isneeded.

In still other alternative embodiments, more than one bodycharacteristic is measured, and the measurements are provided as inputsto a controller. Measured body characteristics that may be used by thecontroller include, but are not limited to, the blood glucose level,blood and/or ISF pH, body temperature, the concentration of amino acidsin blood (including arginine and/or lysine, and the like), theconcentration of gastrointestinal hormones in blood or ISF (includinggastrin, secretin, cholecystokinin, and/or gastro inhibitory peptide,and the like), the concentration of other hormones in blood or ISF(including glucagons, growth hormone, cortisol, progesterone and/orestrogen, and the like), blood pressure, body motion, respiratory rate,heart rate, and other parameters.

In NGT individuals, the glucose-induced secretion of insulin by healthyβ-cells may be as much as doubled in the presence of excess amino acids.Yet, the presence of excess amino acids alone, without elevated bloodglucose, only mildly increases insulin secretions according to theTextbook of Medical Physiology, Eighth Edition, written by Arthur C.Guyton, published by W. B. Saunders Company, 1991, Ch. 78, pg. 861,section “Other Factors That Stimulate Insulin Secretion”. In particularalternative embodiments, amino acid concentrations are estimated ormeasured, and the controller's insulin response increases when aminoacid concentrations are sufficiently high.

In NGT individuals, the presence of sufficient quantities ofgastrointestinal hormones in the blood causes an anticipatory increasein blood insulin, which suggests that β-cells release insulin beforeincreases in blood glucose due to an individual's anticipation of ameal. In particular alternative embodiments, the concentration ofgastrointestinal hormones is measured or estimated, and whenconcentrations are high enough to indicate that a meal is anticipated,the controller commands are adjusted to cause insulin introduction intothe body even before the blood glucose level changes. In otheralternative embodiments, the controller uses measurements or estimatesof other hormones to modify the rate of insulin secretion.

In NGT individuals, the body's cells take up glucose during periods ofheavy exercise with significantly lower levels of insulin. Inalternative embodiments, physiologic parameters such as body motion,blood pressure, pulse rate, respiratory rate, or the like, are used todetect periods of heavy exercise by the body and therefore provideinputs to the controller that decreases (or eliminates) the amount ofinsulin infused into the body to compensate for glucose concentrations.

Sensor Compensation and End-of-Life Detection

In particular embodiments, the sensor sensitivity 510 may degrade overtime, as shown in FIG. 31B. As the sensor sensitivity 510 changes thesensor signal accuracy degrades. If the sensor sensitivity 510 changessignificantly then the sensor must be recalibrated or replaced. Adiagnostic signal may be used to evaluate whether sensor signal accuracyhas changed and/or may be used to adjust the signal or to indicate whento recalibrate or replace the sensor. As the sensor sensitivity 510decreases, the measured glucose level 512 using the sensor signalunderestimates the actual blood glucose level 514, and the measurementerror 516 between the measured glucose level 512 and the actual bloodglucose level 514 becomes greater over time, as shown in FIG. 31A. Thesensor sensitivity 510 decreases due to increases in sensor resistanceRs, as shown in FIG. 31C. The sensor resistance Rs is the resistanceprovided by the body between the working electrode WRK and the counterelectrode CNT, shown as the sum or R1 and R2 in the circuit diagram ofFIG. 7. The sensor resistance Rs can be obtained indirectly by measuringthe analog sensor signal Isig and the counter electrode voltage Vcnt andthen calculating the resistance, Rs=Vcnt/Isig.

As the sensor resistance Rs increases, the analog sensor signal Isigresponse to a given glucose concentration decreases. In preferredembodiments, the decrease in the analog sensor signal Isig may becompensated for by identifying the amount that the sensor resistance Rshas changed since the last calibration and then using the change inresistance in a correction algorithm 454 to adjust the analog sensorsignal value. A compensation value calculated by the correctionalgorithm 454 is used to increase the sensor analog signal value. Thecompensation value increases over time as the sensor resistance Rsincreases. The correction algorithm 454 includes at least one value thatvaries with changes in sensor resistance Rs. In particular embodiments,a low pass filter is applied to the sensor resistance Rs measurement todecrease high frequency noise before evaluating how much the sensorresistance Rs has changed since the last calibration.

In alternative embodiments, the sensor resistance Rs may be calculatedusing different equations. For instance, a sensor resistance Rs₂ may becalculated as:Rs ₂=(V ₀−Vcnt/Isig)

In particular embodiments, V₀ is the same voltage as Vset. An advantageof this approach is that it accounts for the voltage level Vset, whichcan vary from sensor to sensor and/or monitor to monitor, and/or as theanalog sensor signal changes. This removes the noise and/or offsetassociated with variations in Vset, and can provide a more accurateindication of sensor resistance. In other particular embodiments, V₀ isset at −0.535 volts, which is a commonly used voltage for Vset. Infurther embodiments, V₀ is calculated from paired measurements of Vcntand Isig. Using least squares or another curve fitting method, amathematical equation representing the curve (typically a straight lineequation) is derived from the relationship between Vcnt and Isig. Then,V₀ is obtained by extrapolating the curve to find the value for Vcntwhen Isig is zero.

FIG. 38 shows a comparison between calculating the sensor resistancewith V₀ and without V₀. The plot 380A is a plot of sensor signalmeasurements and Via measurements with respect to time in accordancewith an embodiment of the present invention. The plot 380B is a plot ofa measured counter electrode voltage Vcnt with respect to time inaccordance with an embodiment of the present invention. The plot 380C isa plot of calculated sensor sensitivity with respect to time inaccordance with an embodiment of the present invention. The plot 380D isa plot of a calculation of sensor resistance Rs₁ with respect to time inaccordance with an embodiment of the present invention. The plot 380E isa plot of another calculation of sensor resistance Rs₂ with respect totime in accordance with an embodiment of the present invention. The plot380F is a plot of the derivative of the sensor resistance Rs₁ (plot380D) with respect to time in accordance with an embodiment of thepresent invention. The plot 380G is a plot of the derivative of thesensor resistance Rs₂ (plot 380E) with respect to time in accordancewith an embodiment of the present invention. The plot 380H is a plot ofwhen sensors were replaced with respect to time in accordance with anembodiment of the present invention. The plot 380G of the derivative ofRs₂ is cleaner and indicates the sensor failure more clearly than theplot 380F of the derivative of Rs. Hence sensor resistance Rs₂ may beused instead of, or in conjunction with, sensor resistance Rs describedabove.

In preferred embodiments, the sensor is recalibrated or replaced whenthe change in the sensor resistance Rs since the last calibrationexceeds a threshold, or the rate of change of the sensor resistancedRs/dt exceeds another threshold. In particular embodiments, the rate ofchange of the sensor resistance dRs/dt may be compared to two thresholdsas shown in FIG. 32. If dRs/dt exceeds a “replacement” threshold then awarning is provided to the user to replace the sensor. If dRs/dt exceedsa “recalibrate” threshold then a warning is provided to the user torecalibrate the sensor.

In an example shown in FIGS. 33A-C, the analog sensor signal Isigdecreases dramatically at approximately 0.3 days, as seen in FIG. 33A.Given only the analog sensor signal Isig, the user would believe thatthe decrease in the analog sensor signal Isig is due to a decrease inblood glucose. But in reality the drop in the analog sensor signal Isigis due to a sudden change in sensor sensitivity. The sensor resistanceRs, shown in FIG. 33A increases as the analog sensor signal Isig dropsat about 0.3 days. The derivative of the sensor resistance dRs/dt, shownin FIG. 33C, clearly shows a spike 524 at about 0.3 days when the analogsensor signal Isig dropped. The spike 524 in the change in sensorresistance dRs/dt indicates a sensor anomaly rather than a realisticdrop in blood glucose. If a threshold were placed at +/−4 on the dRs/dt,the user would have received a warning to replace the sensor at about0.3 days. As seen in FIG. 33A, the sensor was not replaced until about1.4 days. The analog sensor signal Isig was under estimating the trueglucose level from about 0.3 days until the sensor was replaced at about1.4 days.

In particular embodiments, the amount of time dt over which thederivative of the sensor resistance Rs is taken is the entire time sincethe last calibration. In other embodiments, the amount of time dt overwhich the derivative is taken is fixed, for example over the last hour,90 minutes, 2 hours, or the like.

In alternative embodiments, the sensor is recalibrated or replaced whenthe integral of the sensor resistance Rs over a predetermined timewindow (f Rs d/dt) exceeds a predetermined resistance integralthreshold. An advantage to this approach is that it tends to filter outpotential noise that could be encountered from a signal that includesoccasional spikes, sudden variations in voltage levels, or the like.Preferably, the integral of the sensor resistance Rs is calculated overa time window (such as 15 minutes, or the like) based on Rs measurementsobtained at set rates (such as 1 minute, 5 minutes, or the like) duringthe time window. In alternative embodiments, the time windows may belonger or shorter and different sampling rates may be used, with theselection being dependent on noise, response of the system, samplingrate used in the controller, or the like. In further embodiments, thetime windows and sampling rates may change over time, such as whenapproaching the end of the expected sensor life, or as the equationsindicate that the sensor is degrading, or the like.

Like above, multiple thresholds may be used. For instance, if ∫Rs d/dtexceeds a “replacement” threshold then a warning is provided to the userto replace the sensor. And if ∫Rs d/dt exceeds a “recalibrate” thresholdthen a warning is provided to the user to recalibrate the sensor. Infurther alternative embodiments, the counter electrode voltage Vcnt isused to evaluate other characteristics such as, sensor accuracy, sensorbio-fouling, sensor function, sensor voltage operating range, sensorattachment, or the like.

pH Controller Input

In alternative embodiments, the controller uses measurements of both theinterstitial fluid (ISF) glucose level and a local pH in the ISFsurrounding the sensor to generate commands for the infusion device. Inparticular alternative embodiments, a single multi-sensor 508 located inthe subcutaneous tissue is used to measure both the glucose level andthe pH. The tip of the multi-sensor 508 that is placed into thesubcutaneous tissue with three electrodes is shown in FIG. 30. Theworking electrode 502 is plated with platinum black and coated withglucose oxidase (GOX). The reference electrode 506 is coated withsilver-silver chloride. And the counter electrode 504 is coated withiridium oxide (Ir Ox). The analog sensor signal Isig is generated at theworking electrode 502 due to the reaction between glucose oxidase GOXand the ISF glucose as described with the preferred sensor embodiment.In this alternative embodiment however, as glucose in the ISF reactswith the glucose oxidase GOX on the working electrode and gluconic acidis generated, the local pH in the ISF surrounding the sensor decreases,which changes the potential of the iridium oxide on the counterelectrode 504, with respect to the reference electrode REF. So, as thepH decreases, the voltage at the counter electrode 504 increases.Therefore, as the glucose concentration increases, the local pHdecreases, which causes the counter electrode voltage to increase. So,the glucose concentration may be estimated based on the counterelectrode voltage. The counter electrode voltage estimate of glucoseconcentration can be compared to the estimate of glucose level from theanalog sensor signal Isig. The two estimates of the glucose level may becombined by a weighted average or one estimate may simply be used as acheck to verify that the other sensing method is functioning properly.For example, if the difference between the two estimates is 10% for aperiod of time and then suddenly the difference increased to 50%, awarning would be issued indicating to the user that the sensor may needto be replaced or recalibrated.

In additional alternative embodiments, the pH level near the sensor maybe used to detect infection. By tracking trends in the pH over time, adramatic change in pH may be used to identify that an infection hasdeveloped in proximity to the sensor. A warning is used to notify theuser to replace the sensor.

The pH sensor may be used in other embodiments. When insulin is notavailable to assist the body to use glucose, the body shifts toconsuming fat for energy. As the body shifts from using glucose to usingalmost exclusively fat for energy, concentrations of keto acids(acetoacetic acid and β-hydroxybutyric acid) increase from about 1mEq/liter to as high as 10 mEq/liter. In particular alternativeembodiments, the pH level is measured to detect increases in keto acidsin the body. In embodiments of the present invention, a warning isprovided to the user when the ISF pH level is too low.

A side effect of the increased of keto acid concentrations is thatsodium is drawn from the body's extra cellular fluid to combine with theacids so that the body can excrete the acids. This leads to increasedquantities of hydrogen ions, which greatly increases the acidosis.Severe cases lead to rapid deep breathing, acidotic coma and even death.In other alternative embodiments, an ion-selective electrode (ISE) isused to detect changes in sodium concentration. A special membrane isused to coat the ISE so that it only senses changes in sodiumconcentration. In particular alternative embodiments, the ISE is afourth electrode added to the glucose sensor. In another alternativeembodiment, a three-electrode system is used with a silver-silverchloride reference electrode REF, an Ir Ox counter electrode CNT, and asodium ion-selective (Na ISE) working electrode WRK.

While pH measurements, end-of-life measurements, hormone measurements,or the like, add inputs to the controller that can significantly affectthe accuracy of insulin delivery, the basic input to the controller isgenerally a glucose measurement. The glucose measurement is provided bythe sensor system. And once the controller uses the glucose measurementto generate commands, the delivery system executes the commands. Thefollowing is a detailed description of several apparatus embodiments forthe sensor system and the delivery system.

Sensor System

The sensor system provides the glucose measurements used by thecontroller. The sensor system includes a sensor, a sensor set to holdthe sensor if needed, a telemetered characteristic monitor transmitter,and a cable if needed to carry power and/or the sensor signal betweenthe sensor and the telemetered characteristic monitor transmitter.

Sensor and Sensor Set

In preferred embodiments, the glucose sensor system 10 includes a thinfilm electrochemical sensor such as the type disclosed in U.S. Pat. No.5,391,250, entitled “METHOD OF FABRICATING THIN FILM SENSORS”; U.S.patent application Ser. No. 09/502,204, filed on Feb. 10, 2000 andissued on Nov. 19, 2002 as U.S. Pat. No. 6,484,045, entitled “IMPROVEDANALYTE SENSOR AND METHOD OF MAKING THE SAME”; or other typical thinfilm sensors such as described in commonly assigned U.S. Pat. Nos.5,390,671; 5,482,473; and 5,586,553 which are incorporated by referenceherein. See also U.S. Pat. No. 5,299,571.

The glucose sensor system 10 also includes a sensor set 28 to supportthe sensor 26 such as described in U.S. Pat. No. 5,586,553, entitled“TRANSCUTANEOUS SENSOR INSERTION SET” (published as PCT Application WO96/25088); and U.S. Pat. No. 5,954,643, entitled “INSERTION SET FOR ATRANSCUTANEOUS SENSOR” (published as PCT Application WO 98/56293); andU.S. Pat. No. 5,951,521, entitled “A SUBCUTANEOUS IMPLANTABLE SENSOR SETHAVING. THE CAPABILITY TO REMOVE OR DELIVER FLUIDS TO AN INSERTIONSITE”, which are incorporated by reference herein.

In preferred embodiments, the sensor 26 is inserted through the user'sskin 46 using an insertion needle 58, which is removed and disposed ofonce the sensor is positioned in the subcutaneous tissue 44. Theinsertion needle 58 has a sharpened tip 59 and an open slot 60 to holdthe sensor during insertion into the skin 46, as shown in FIGS. 3C and Dand FIG. 4. Further description of the needle 58 and the sensor set 28are found in U.S. Pat. No. 5,586,553, entitled “TRANSCUTANEOUS SENSORINSERTION SET” (published as PCT Application WO 96/25088); and U.S. Pat.No. 5,954,643, entitled “INSERTION SET FOR A TRANSCUTANEOUS SENSOR”(published as PCT Application WO 98/5629), which are incorporated byreference herein.

In preferred embodiments, the sensor 26 has three electrodes 42 that areexposed to the interstitial fluid (ISF) in the subcutaneous tissue 44 asshown in FIGS. 3D and 4. A working electrode WRK, a reference electrodeREF and a counter electrode CNT are used to form a circuit, as shown inFIG. 7. When an appropriate voltage is supplied across the workingelectrode WRK and the reference electrode REF, the ISF providesimpedance (R1 and R2) between the electrodes 42. And an analog currentsignal Isig flows from the working electrode WRK through the body (R1and R2, which sum to Rs) and to the counter electrode CNT. Preferably,the working electrode WRK is plated with platinum black and coated withglucose oxidase (GOX), the reference electrode REF is coated withsilver-silver chloride, and the counter electrode is plated withplatinum black. The voltage at the working electrode WRK is generallyheld to ground, and the voltage at the reference electrode REF issubstantially held at a set voltage Vset. Vset is between 300 and 700mV, and preferably to about 535 mV.

The most prominent reaction stimulated by the voltage difference betweenthe electrodes is the reduction of glucose as it first reacts with GOXto generate gluconic acid and hydrogen peroxide (H₂O₂). Then the H₂O₂ isreduced to water (H₂O) and (O⁻) at the surface of the working electrodeWRK. The O⁻ draws a positive charge from the sensor electricalcomponents, thus repelling an electron and causing an electrical currentflow. This results in the analog current signal Isig being proportionalto the concentration of glucose in the ISF that is in contact with thesensor electrodes 42. The analog current signal Isig flows from theworking electrode WRK, to the counter electrode CNT, typically through afilter and back to the low rail of an op-amp 66. An input to the op-amp66 is the set voltage Vset. The output of the op-amp 66 adjusts thecounter voltage Vcnt at the counter electrode CNT as Isig changes withglucose concentration. The voltage at the working electrode WRK isgenerally held to ground, the voltage at the reference electrode REF isgenerally equal to Vset, and the voltage Vcnt at the counter electrodeCNT varies as needed.

In alternative embodiments, more than one sensor is used to measureblood glucose. In particular embodiments, redundant sensors are used.The user is notified when a sensor fails by the telemeteredcharacteristic monitor transmitter electronics. An indicator may alsoinform the user of which sensors are still functioning and/or the numberof sensors still functioning. In other particular embodiments, sensorsignals are combined through averaging or other means. If the differencebetween the sensor signals exceeds a threshold then the user is warnedto recalibrate or replace at least one sensor. In other alternativeembodiments, more than one glucose sensor is used, and the glucosesensors are not of the same design. For example, an internal glucosesensor and an external glucose sensor may be used to measure bloodglucose at the same time.

In alternative embodiments, other continuous blood glucose sensors andsensor sets may be used. In particular alternative embodiments, thesensor system is a micro needle analyte sampling device such asdescribed in U.S. patent application Ser. No. 09/460,121, filed on Dec.13, 1999, entitled “INSERTION SET WITH MICROPIERCING MEMBERS AND METHODSOF USING THE SAME”, incorporated by reference herein, or an internalglucose sensor as described in U.S. Pat. Nos. 5,497,772; 5,660,163;5,791,344; and 5,569,186, and/or a glucose sensor that uses florescencesuch as described in U.S. Pat. No. 6,011,984 all of which areincorporated by reference herein. In other alternative embodiments, thesensor system uses other sensing technologies such as described inPatent Cooperation Treaty publication No. WO 99/29230, light beams,conductivity, jet sampling, micro dialysis, micro-poration, ultra sonicsampling, reverse iontophoresis, or the like. In still other alternativeembodiments, only the working electrode WRK is located in thesubcutaneous tissue and in contact with the ISF, and the counter CNT andreference REF electrodes are located external to the body and in contactwith the skin. In particular embodiments, the counter electrode CNT andthe reference electrode REF are located on the surface of a monitorhousing 518 and are held to the skin as part of the telemeteredcharacteristic monitor, as shown in FIG. 34A. In other particularembodiments, the counter electrode CNT and the reference electrode REFare held to the skin using other devices such as running a wire to theelectrodes and taping the electrodes to the skin, incorporating theelectrodes on the underside of a watch touching the skin, or the like.In more alternative embodiments, more than one working electrode WRK isplaced into the subcutaneous tissue for redundancy. In additionalalternative embodiments, a counter electrode is not used, a referenceelectrode REF is located outside of the body in contact with the skin,and one or more working electrodes WRK are located in the ISF. Anexample of this embodiment implemented by locating the referenceelectrode REF on a monitor housing 520 is shown in FIG. 34B. In otherembodiments, ISF is harvested from the body of an individual and flowedover an external sensor that is not implanted in the body.

Sensor Cable

In preferred embodiments, the sensor cable 32 is of the type describedin U.S. patent application Ser. No. 60/121,656, filed on Feb. 25, 1999,entitled “TEST PLUG AND CABLE FOR A GLUCOSE MONITOR”, which isincorporated by reference herein. In other embodiments, other cables maybe used such as shielded, low noise cables for carrying nA currents,fiber optic cables, or the like. In alternative embodiments, a shortcable may be used or the sensor may be directly connected to a devicewithout the need of a cable.

Telemetered Characteristic Monitor Transmitter

In preferred embodiments, the telemetered characteristic monitortransmitter 30 is of the type described in U.S. patent application Ser.No. 09/465,715, filed on Dec. 17, 1999, entitled “TELEMETEREDCHARACTERISTIC MONITOR SYSTEM AND METHOD OF USING THE SAME” (publishedas PCT Application WO 00/19887 and entitled, “TELEMETERED CHARACTERISTICMONITOR SYSTEM”), which is incorporated by reference herein, and isconnected to the sensor set 28 as shown in FIGS. 3A and B.

In alternative embodiments, the sensor cable 32 is connected directly tothe infusion device housing, as shown in FIG. 8A, which eliminates theneed for a telemetered characteristic monitor transmitter 30. Theinfusion device contains a power supply and electrical components tooperate the sensor 26 and store sensor signal values.

In other alternative embodiments, the telemetered characteristic monitortransmitter includes a receiver to receive updates or requests foradditional sensor data or to receive a confirmation (a hand-shakesignal) indicating that information has been received correctly.Specifically, if the telemetered characteristic monitor transmitter doesnot receive a confirmation signal from the infusion device, then itre-sends the information. In particular alternative embodiments, theinfusion device anticipates receiving blood glucose values or otherinformation on a periodic basis. If the expected information is notsupplied when required, the infusion device sends a “wake-up” signal tothe telemetered characteristic monitor transmitter to cause it tore-send the information.

Insulin Delivery System

Infusion Device

Once a sensor signal 16 is received and processed through the controller12, commands 22 are generated to operate the infusion device 34. Inpreferred embodiments, semi-automated medication infusion devices of theexternal type are used, as generally described in U.S. Pat. Nos.4,562,751; 4,678,408; 4,685,903; and U.S. patent application Ser. No.09/334,858, filed on Jun. 17, 1999, entitled “EXTERNAL INFUSION DEVICEWITH REMOTE PROGRAMMING, BOLUS ESTIMATOR AND/OR VIBRATION CAPABILITIES”(published as PCT application WO 00/10628), which are hereinincorporated by reference. In alternative embodiments, automatedimplantable medication infusion devices, as generally described in U.S.Pat. Nos. 4,373,527 and 4,573,994, are used, which are incorporated byreference herein.

Insulin

In preferred embodiments, the infusion device reservoir 50 containsHUMALOG® lispro insulin to be infused into the body 20. Alternatively,other forms of insulin may be used such as HUMALIN®, human insulin,bovine insulin, porcine insulin, analogs, or other insulins such asinsulin types described in U.S. Pat. No. 5,807,315, entitled “METHOD ANDCOMPOSITIONS FOR THE DELIVERY OF MONOMERIC PROTEINS”, and U.S. PatentApplication Ser. No. 60/177,897, filed on Jan. 24, 2000, entitled “MIXEDBUFFER SYSTEM FOR STABILIZING POLYPEPTIDE FORMULATIONS”, which areincorporated by reference herein, or the like. In further alternativeembodiments, other components are added to the insulin such aspolypeptides described in U.S. patent application Ser. No. 09/334,676,filed on Jun. 25, 1999, entitled “MULTIPLE AGENT DIABETES THERAPY”,small molecule insulin mimetic materials such as described in U.S.patent application Ser. No. 09/566,877, filed on May 8, 2000 and issuedon Oct. 8, 2002 as U.S. Pat. No. 6,461,331, entitled “DEVICE AND METHODFOR INFUSION OF SMALL MOLECULE INSULIN MIMETIC MATERIALS”, both of whichare incorporated by reference herein, or the like.

Infusion Tube

In preferred embodiments, an infusion tube 36 is used to carry theinsulin 24 from the infusion device 34 to the infusion set 38. Inalternative embodiments, the infusion tube carries the insulin 24 frominfusion device 34 directly into the body 20. In further alternativeembodiments, no infusion tube is needed, for example if the infusiondevice is attached directly to the skin and the insulin 24 flows fromthe infusion device, through a cannula or needle directly into the body.In other alternative embodiments, the infusion device is internal to thebody and an infusion tube may or may not be used to carry insulin awayfrom the infusion device location.

Infusion Set

In preferred embodiments, the infusion set 38 is of the type describedin U.S. Pat. No. 4,755,173, entitled “SOFT CANNULA SUBCUTANEOUSINJECTION SET”, which is incorporated by reference herein. Inalternative embodiments, other infusion sets, such described in U.S.Pat. Nos. 4,373,527 and 4,573,994, are used, which are incorporated byreference herein. In alternative embodiments, other infusion sets, suchas the Rapid set from Disetronic, the Silhouette from MiniMed, or thelike, may be used. In further alternative embodiments, no infusion setis required, for example if the infusion device is an internal infusiondevice or if the infusion device is attached directly to the skin.

Configurations With Supplemental Devices

In further alternative embodiments, the pre-filter, filters, calibratorand/or controller 12 are located in a supplemental device that is incommunication with both the telemetered characteristic monitortransmitter 30 and the infusion device 34. Examples of supplementaldevices include, a hand held personal digital assistant such asdescribed in U.S. patent application Ser. No. 09/487,423, filed on Jan.20, 2000 and issued on May 6, 2003 as U.S. Pat. No. 6,558,320, entitled“HANDHELD PERSONAL DATA ASSISTANT (PDA) WITH A MEDICAL DEVICE AND METHODOF USING THE SAME”, which is incorporated by reference herein, acomputer, a module that may be attached to the telemeteredcharacteristic monitor transmitter 30, a module that may be attached tothe infusion device 34, a RF programmer such as described in U.S. patentapplication Ser. No. 09/334,858, filed on Jun. 17, 1999 and issued onApr. 29, 2003 as U.S. Pat. No. 6,554,798, entitled EXTERNAL INFUSIONDEVICE WITH REMOTE PROGRAMMING, BOLUS ESTIMATOR AND/OR VIBRATIONCAPABILITIES (published as PCT application WO 00/10628), which isincorporated by reference herein, or the like. In particularembodiments, the supplemental device includes a post-calibration filter,a display, a recorder, and/or a blood glucose meter. In furtheralternative embodiments, the supplemental device includes a method for auser to add or modify information to be communicated to the infusiondevice 34 and/or the telemetered characteristic monitor transmitter 30such as buttons, a keyboard, a touch screen, and the like.

In particular alternative embodiments, the supplemental device is acomputer in combination with an analyte monitor and a RF programmer. Theanalyte monitor receives RF signals from the telemetered characteristicmonitor transmitter 30, stores the signals and down loads them to acomputer when needed. The RF programmer sends control signals to theinfusion device 34 to reprogram the rate of insulin infusion. Both theanalyte monitor and the RF programmer are placed into separatecommunication stations. The communication stations include IRtransmitters and IR receivers to communicate with the analyte monitorand the RF programmer. The sensor signal values are transmitted via thetelemetered characteristic monitor transmitter 30 to the analyte monitorlocated in one of the communication stations. Then the sensor signalvalues are communicated through the IR receiver in a first communicationstation and to the computer. The computer processes the sensor signalvalues through one or more filters, calibrators, and controllers togenerate commands 22. The commands are sent to a second communicationstation and sent to an RF programmer by the IR transmitter in thecommunication station. Finally the RF programmer transmits the commands22 to the infusion device 34. The communication station, analyte monitorand infusion device 34 may be of the type described in U.S. patentapplication Ser. No. 09/409,014, filed on Sep. 29, 1999 entitledCOMMUNICATION STATION FOR INTERFACING WITH AN INFUSION PUMP, ANALYTEMONITOR, ANALYTE METER OR THE LIKE (published as a PCT application WO00/18449), which is incorporated by reference herein. Alternatively, theRF programmer may be omitted and the infusion device may be placed in acommunication station, or the infusion device may receive the commandswithout the use of an RF programmer and/or a communication station.

Overnight Closed-Loop System

A closed-loop insulin delivery system of the type described herein mayutilize a variety of control algorithms to regulate the delivery ofinsulin to the body of the patient in a safe and predictable manner.Overnight operation of a closed-loop insulin infusion system should becarefully controlled in an automated way that need not depend onpatient, user, or caregiver interaction. In this regard, a number ofsafeguards can be implemented with the system. These safeguards areintended to provide actionable sensor glucose readings, assess theaccuracy of sensor readings, and constrain insulin delivery based uponpossible sensor over-read conditions. These safeguards will alert theuser and allow the patient to take appropriate actions. Therefore, thesesafeguards will mitigate the potential risks of overnight closed-loopcontrol.

The control algorithm utilized by the system may be considered to be onetype of safeguard in that it emulates the effect of insulin inhibitinginsulin secretion. The system may also implement sensor performancesafeguards. For example, a closed-loop initiation algorithm determinesif the system can enter the closed-loop mode by calculating a recentcalibration factor. The initiation algorithm checks the time betweenrecent and prior calibration factors and determines the relative sensorerror between the readings. As another example of a sensor safeguard,the system may employ a model supervisor during the closed-loop mode.The model supervisor checks that the sensor glucose readings areadequate for use during overnight closed-loop mode by comparingmodel-predicted sensor glucose values in real-time against actual sensorglucose values. If the model-predicted glucose values and the actualvalues differ significantly, the system triggers a fail-safe alertindicating a faulty sensor. This fail-safe alert can be generated inresponse to a number of sensor issues, such as sensor drift, sensordislodgement, sensor compression artifact, etc.

The system may also implement a target glucose level safeguard. In thisregard, a start-up algorithm can be deployed to provide a smoothtransition between the open-loop mode and the closed-loop mode bygradually adjusting the target glucose level while in the closed-loopmode. The adjusted target glucose is used by the closed-loop controlalgorithm until the adjusted target glucose converges to a particularsetpoint. At that time, the setpoint can be used for future dosingcalculations during the closed-loop mode.

The system may also utilize at least one insulin limit as an insulindelivery and sensor performance safeguard. In this context, the insulinlimit constrains the maximum amount of insulin delivered to the patientat any time in order to avoid over-delivery of insulin by theclosed-loop control system due to potential sensor faults. In practice,the insulin limit is a value that is specific to each patient and iscalculated based on the patient's basal rate, fasting blood glucose, andinsulin sensitivity.

The system may also employ one or more insulin delivery safeguards. Forexample, an insulin delivery timeout continuously monitors (duringclosed-loop operation) if the patient is receiving insulin at theinsulin limit for a prolonged period of time and, if so, triggers afail-safe alert. This safeguard also monitors if the system is notdelivering insulin for a prolonged period of time and, if so, triggers afail-safe alert. A correction bolus is another insulin deliverysafeguard. The system calculates an insulin bolus dosage for mitigatinghyperglycemia at the commencement of closed-loop mode if the patient isabove a designated blood glucose threshold. The determination can beachieved by acquiring a blood glucose meter reading at the initiation ofclosed-loop mode. The correction bolus is calculated based on thepatient's insulin sensitivity, the amount of insulin on board, and aglucose target. Insulin on board (IOB) compensation is yet anotherinsulin delivery safeguard. IOB compensation estimates the amount ofinsulin on board based on manual boluses administered, such that thesystem can effectively account for the JOB. In this regard, the manualboluses may be subtracted from the insulin dose that is calculated bythe PID-IFB control algorithm.

The system may also implement one or more communication safeguards. Forexample, a “missed sensor transmission” feature continuously monitorsdata being received by the controller. For missed data packets totalingless than 15 minutes of operating time, the system remains inclosed-loop mode. During this time, however, the system continues tocalculate the insulin dose using the closed loop control algorithm basedon the last valid sensor glucose value. For missed data packets totaling15-60 minutes, the safeguard will switch to a pre-programmed safe basalrate, defined as half the patient's night time basal rate. If thecontroller starts receiving data packets during the safe basal ratetimeframe, the system will again switch to the closed-loop mode. Formissed data packets totaling more than 60 minutes, the system willswitch to the open-loop mode where it will deliver a pre-programmedbasal rate (which may be set by a caregiver).

The exemplary closed-loop control algorithms, methodologies, andtechniques described in more detail below may be based around a PIDcontrol algorithm of the type presented in the preceding sections ofthis disclosure. In certain embodiments, the closed-loop controlalgorithms utilize a PID insulin feedback (PID-IFB) control algorithm.More specifically, the PID-IFB control algorithm cooperates with otheralgorithms, processes, and controls that represent additional safeguardsthat may apply during overnight use (and/or during other periods ofuse). These additional safeguards may include, without limitation: theuse of an “Insulin Limits” parameter; a closed-loop initiation circuitthat is based on glucose sensor calibration; an insulin on board (IOB)compensation algorithm; monitoring missed transmissions; and monitoringsensor glucose against predicted sensor glucose.

In practice, optimal or desired settings for the Insulin Limitsparameter should be determined. In this regard, the Insulin Limitsparameter serves as an input to the controller logic for each patient,and it imposes an upper limit to the insulin delivery rate as anadditional safety feature to avoid over-delivery of insulin by thecontroller due to potential sensor error. In certain embodiments, theInsulin Limits parameter is calculated from the patient's basal rate,fasting blood glucose, and insulin sensitivity.

Referring again to FIG. 1, a closed-loop system generally includes aglucose sensor system 10, a controller 12, and an insulin deliverysystem 14. Although FIG. 1 depicts these primary elements as separateblocks, embodiments of the system may combine two or more of theillustrated blocks into a single physical component. For example, aninvestigational test configuration of the closed-loop system may includea traditional patient-worn infusion pump (corresponding to the insulindelivery system 14), a conventional continuous glucosesensor/transmitter assembly (corresponding to the glucose sensor system10), and a mobile computing device with a suitably written softwareapplication installed thereon (corresponding to the controller 12). Themobile computing device may be, for example: a smartphone; a tabletcomputer; a netbook computer; a digital media player; a handheld videogame device; or the like. It should be appreciated that the desiredclosed-loop control functionality can be carried out by way of one ormore computer-executable programs or applications designed to run on themobile computing device. An investigational test configuration may alsoinclude a translator device that serves as a data communicationinterface between the mobile computing device (which may utilizestandard wireless data communication technologies such as the Wi-Fi orBLUETOOTH data communication protocol) and the glucose sensor system 10(which may use a proprietary data communication protocol that is usuallyincompatible with the mobile computing device).

In other embodiments, the functionality of the glucose sensor system 10could be integrated into the insulin delivery system 14, perhaps as aninterchangeable disposable module that attaches to the housing of theinsulin delivery system 14. In yet other embodiments, the functionalityof the controller 12 could be incorporated into the insulin deliverysystem 14 such that a separate and distinct controller device need notbe carried by the patient. Indeed, the control software utilized by thecontroller 12 can be ported for installation in an insulin infusionpump, a pump monitor device, or the like to implement the functionalityof the controller 12 in those devices if so desired. In furtherembodiments, a single hardware device platform could be suitablydesigned to accommodate the functionality of the insulin delivery system14, the glucose sensor system 10, and the controller 12. These and otherpossible implementations are contemplated by this disclosure, and theparticular manner in which the closed-loop system is configured anddeployed is not intended to limit or otherwise restrict the scope orapplication of the closed-loop control techniques described herein.

Although not shown in FIG. 1, the closed-loop system may include orcooperate with a conventional blood glucose meter (e.g., a finger stickdevice) that provides measured BG values to the controller 12 and/or tothe insulin delivery system 14, such that the glucose sensor system 10can be calibrated. In certain embodiments, the measured BG values aresent to the insulin delivery system 14, which in turn sends the BGvalue, sensor calibration factor, and calibration time to the controller12. The controller 12 can process and analyze the received informationto determine whether or not the system can enter the closed-loopoperating mode. In this regard, the controller 12 may check to ensurethat the calibration of the glucose sensor system 10 is within anacceptable range before allowing the system to enter the closed-loopmode.

After entering the closed-loop mode, the insulin delivery system 14sends sensor glucose (SG) values, sensor Isig values, calibrationfactors, “insulin delivered” values, and other data as needed to thecontroller 12 in accordance with a predetermined schedule, e.g., at fiveminute intervals. The controller 12 determines the desired insulin dosebased on the closed-loop algorithm to maintain the patient at a targetglucose setpoint, and communicates suitable control data andinstructions to the insulin delivery system 14. The insulin deliverysystem 14 responds to deliver the insulin dose specified by thecontroller 12 to the user.

FIG. 49 is a block diagram that illustrates processing modules andalgorithms of an exemplary embodiment of a closed-loop system controller900, and FIG. 50 is a flow chart that illustrates an exemplaryembodiment of a control process 1000 that may be performed at least inpart by the controller 900 to control the insulin delivery system 14.The controller 12 shown in FIG. 1 may be configured in accordance withthat shown in FIG. 49. FIG. 49 schematically depicts certain inputs andoutputs of the controller 900, where the parallelograms represent theinputs, the ovals represent the outputs, and the rectangles representthe various functional modules of the controller 900. In the context ofthis description, a “functional module” may be any process, technique,method, algorithm, computer-executable program logic, or the like. Inthis regard, the controller 900 could be realized as any electronicdevice having a processor architecture with at least one processordevice, and at least one memory element that is cooperatively associatedwith the processor architecture. The processor architecture is suitablyconfigured to execute processor-executable instructions stored in the atleast one memory element such that the controller 900 can perform thevarious control operations and methods described in detail herein.

The host electronic device that implements the controller 900 may berealized as a monitor device for an insulin infusion device, where themonitor device and the insulin infusion device are two physicallydistinct hardware devices. In another embodiment of the system, the hostelectronic device that implements the controller 900 may be realized asa portable wireless device, where the portable wireless device and theinsulin infusion device are two physically distinct hardware devices.The portable wireless device in this context may be, without limitation:a mobile telephone device; a tablet computer device; a laptop computerdevice; a portable video game device; a digital media player device; aportable medical device; or the like. In yet other system embodiments,the host electronic device and the insulin infusion device arephysically and functionally integrated into a single hardware device. Insuch embodiments, the insulin infusion device will include thefunctionality of the controller 900 as presented here.

Certain embodiments of the controller 900 include a plurality ofcooperating functional modules that are designed and configured todetermine the insulin dose to be delivered to keep the patient at thetarget glucose setpoint during an overnight closed-loop operating mode.In this regard, the illustrated embodiment of the controller 900 mayinclude the following functional modules, without limitation: aclosed-loop initiation module 902; a start-up module 904; a proportionalintegral derivative insulin feedback (PID-IFB) control module 906; aninsulin limit module 908; an insulin on board (IOB) compensation module910; an insulin delivery timeout module 912; a model supervisor module914; and a missed transmission module 916.

Referring to FIG. 50, the control process 1000 may begin at any timewhen it is desired to enter the closed-loop operating mode. Accordingly,the control process 1000 may begin in response to a user-initiatedcommand, automatically in response to the detection of operatingconditions that are usually indicative of closed-loop operation (e.g.,sleeping), or the like. Certain embodiments of the control process 1000may begin with one or more system checks (task 1002) to confirm whetheror not the system is allowed to enter the closed-loop operating mode.This particular example employs a sensor calibration check beforeallowing the system to proceed to the closed-loop mode. Referring toFIG. 49, the closed-loop initiation module 902 may be involved duringtask 1002.

In some embodiments, the closed-loop initiation module 902 may considercertain sensor performance criteria that prevents closed-loopinitiation. Such criteria may include, without limitation: (1) duringstart-up when the calibration is not stable; (2) when the sensorsensitivity changes significantly; (3) when sensors may be calibratedwith a potentially invalid meter reading thereby changing the sensorsensitivity significantly; (4) any other situation that could cause amismatch between the sensor and meter for a number of most recentcalibrations spaced over a designated period of time (e.g., the two mostrecent calibrations).

The illustrated embodiment of the closed-loop initiation module 902receives at least the following items as inputs: a meter (measured) BGvalue 920; at least one sensor calibration factor 922 (i.e., calibrationmeasurements, calibration data, etc.); the current sensor Isig value924; and timestamp data 926 that indicates the calibration timeassociated with the BG value 920 and the sensor calibration factor 922.Some or all of this input data may be provided directly or indirectly bythe insulin delivery system 14 (see FIG. 1), a translator device, amonitor device, or any device in the closed-loop system. Thisdescription assumes that a new sensor calibration factor 922 and newtimestamp data 926 is generated for each measured BG value 920, whereinthe sensor calibration factor 922 is associated with the calibration ofthe glucose sensor system 10 (see FIG. 1) that is being used to monitorthe patient. In particular, the sensor calibration factor may be basedon the meter BG value 920 and the corresponding sensor Isig value 924.

The closed-loop initiation module 902 analyzes the input data (bothcurrent values and historical values) to determine whether or not thesystem is allowed to enter into the closed-loop mode. For example, theclosed-loop initiation module 902 may: check the period between twoconsecutive calibration timestamp values; compare recent and priorcalibration factor values; and the like. The “outputs” of theclosed-loop initiation module 902 correspond to two operating modes ofthe system. More specifically, the closed-loop initiation module 902controls whether the system remains operating in the open-loop mode 928or whether the system starts the closed-loop mode 930.

Referring to FIG. 50, if the closed-loop mode is not permitted (the “No”branch of query task 1004), then the control process 1000 operates thesystem such that it remains in the open-loop mode (task 1006). On theother hand, if the closed-loop mode is permitted (the “Yes” branch ofquery task 1004), then the control process 1000 can initiate and startthe closed-loop mode in an appropriate manner (task 1008). Referringagain to FIG. 49, a correction bolus 932 can be calculated and delivered(if needed) to mitigate hyperglycemia at the commencement of theclosed-loop mode. This correction bolus 932 serves as an additionalsafeguard to achieve a target blood glucose level if a measured meterreading is greater than a threshold value. If the control process 1000determines that a correction bolus is required, then an appropriateinsulin dose instruction is generated for execution by the insulindelivery system at the outset of the closed-loop mode.

Referring to FIG. 49, the start-up module 904 may be called in responseto a determination that the system can proceed to the closed-loopoperating mode. Once the system is in the closed-loop mode, thecontroller retrieves historical data that can be processed and used asdescribed in more detail below. In certain embodiments, for example, thecontroller obtains data for the last 24 hours (from the insulin deliverysystem, from a monitor, or the like). Thereafter, the controllerretrieves data packets once every sampling period to obtain, withoutlimitation: sensor glucose (SG) values; sensor Isig values; sensorcalibration factors; information related to the amount of insulindelivered; information related to manual boluses delivered; and sensorcalibration factors. As explained in more detail below, the receivedinformation can be used in the various safeguards, and to determine thefinal insulin dose.

The start-up module 904 receives sensor glucose (SG) values 940 as aninput, and the functionality of the start-up module 904 may be initiatedin response to the start of the closed-loop mode 930 (this triggermechanism is represented by the dashed arrow 942 in FIG. 49). The SGvalues 940 may be provided directly by the glucose sensor system 10 orindirectly via the insulin delivery system 14, a translator device, orany device in the closed-loop system (see FIG. 1). This descriptionassumes that SG values 940 are received by the start-up module 904 in anongoing manner as they become available. The start-up module 904 mayalso utilize a target glucose setpoint value 944, which may beinternally maintained, generated, and/or provided by the controller 900.For the implementation presented here, the target glucose setpoint value944 represents a fixed (constant) value that the user can specify (FIG.49 depicts the target glucose setpoint value 944 in dashed lines toindicate that the value is a user-specified parameter rather than afunctional module or data received by the system).

In certain embodiments, the start-up module 904 calculates a finaltarget glucose value 946, which serves as an input to the PID-IFBcontrol module 906. The final target glucose value 946 enables thesystem to make a smoother transition between open-loop and closed-loopmodes (by gradually adjusting the final target glucose value 946). Thestart-up module 904 may utilize the target glucose setpoint value 944 tocalculate the final target glucose value 946. In this regard, thestart-up module 904 elevates the final target glucose value 946 to thesame level as the sensor glucose value at the start of the closed-loopmode, provided the sensor glucose is above a certain threshold. As timeprogresses, the final target glucose value 946 gradually decreases backto the target glucose setpoint value 944 (usually in approximately twohours). Referring to FIG. 50, the control process 1000 calculates thefinal target glucose value (task 1010) and continues by calculating anuncompensated insulin infusion rate, PIDRate(n), based at least in parton the final target glucose value (task 1012). For this example, thestart-up module 904 may be involved during task 1010, and the PID-IFBcontrol module 906 may be involved during task 1012.

As an additional safeguard, the insulin limit module 908 cooperates withthe PID-IFB control module 906 to provide an upper insulin limit that iscalculated based on the patient's basal rate, fasting blood glucose, andinsulin sensitivity. This upper insulin limit imposes an upper limit tothe insulin delivery rate to avoid over-delivery of insulin by thesystem due to potential sensor error.

The PID-IFB control module 906 may be configured to carry out thecontrol processes described in more detail above with reference to FIGS.1-48. In some embodiments, the PID-IFB control module 906 receives atleast the following items as inputs: the SG value 940 (which may be usedto calculate a rate of change value that indicates the rate of change ofthe SG value); the current sensor Isig value 950; the current sensorcalibration factor 952; and an amount of insulin delivered 954. Theinputs to the PID-IFB control module 906 may be provided directly orindirectly by the insulin delivery system 14, the glucose sensor system10, a translator device, a monitor device, and/or any device in theclosed-loop system (see FIG. 1). The PID-IFB control module 906 issuitably configured to calculate the insulin infusion rate based on thecurrent and past SG values 940, the SG rate of change, the sensor Isigvalue 950, the sensor calibration factor 952, the final target glucosevalue 946, and the insulin delivered 954 in order to achieve euglycemia.These (and possibly other) values may be received by the PID-IFB controlmodule 906 in an ongoing manner as they become available, e.g., in fiveminute intervals or in accordance with any desired schedule.

The insulin delivered 954 is a parameter or value that indicates theamount of insulin that has been delivered to the patient by the insulindelivery system. Thus, the insulin delivered 954 may indicate recentboluses (typically by Units) delivered over a period of time. In certainimplementations, the insulin delivered 954 corresponds to the amount ofinsulin delivered in the last sampling time, which may be, withoutlimitation: one minute; five minutes; thirty seconds; or any designatedsampling time. The insulin delivered 954 may also indicate the amount ofinsulin delivered by the delivery system as basal or boluses in anydefined period of time in the past (e.g., the last N hours) or theamount of insulin delivered by the system in the last sampling cycle. Inpractice, the PID-IFB control module 906 (and the IOB compensationmodule 910) may be “initialized” to collect and save historical valuesfor the insulin delivered 954 as needed. Thereafter, the insulindelivered 954 can simply indicate an amount of insulin administered bythe system during the last sampling time period if by a bolus or basalchannels.

As mentioned above, the PID-IFB control module 906 may utilize an upperinsulin limit, which is a patient-specific parameter. In certainembodiments, the upper insulin limit may be entered by the user, acaregiver, or the like. Alternatively, the insulin limit module 908 maybe responsible for calculating or otherwise managing the upper insulinlimit if so desired. The upper insulin limit imposes an upper limit tothe insulin delivery rate as an additional safety feature to avoidover-delivery of insulin by the controller 900 due to potential sensorerror. Thus, if the PID-IFB control module 906 recommends a dose higherthan the insulin limit, the insulin limit will constrain the insulindelivered to the insulin limit value. In addition, the insulin limitwill “freeze” the integral component of the PID to its previous value toprevent integral windup, which can cause continuous integrating of theglucose error until it reaches maximum values. In certain embodiments,the upper insulin limit has a default value set at five times thepatient's basal rate. Hence, if the maximum value is reached, thePID-IFB control algorithm will be fairly aggressive in calculating aninsulin dose. Accordingly, to minimize integral windup, the insulinlimit is fed back to the PID-IFB control module 906 (as depicted in FIG.49) for use in the next insulin dose calculation.

The PID-IFB control module 906 operates as described previously tocalculate a current insulin dose 958 as an output value (the currentinsulin dose 958 is also referred to herein as the uncompensated insulininfusion rate, PIDRate(n)). In practice, the current insulin dose 958 istypically expressed as an infusion rate (Units/Hour). In the context ofthis description, the current insulin dose 958 represents a baselineclosed-loop infusion rate, which may be subjected to further adjustmentor compensation by the IOB compensation module 910. Referring again toFIG. 50, the control process 1000 may compensate for the insulin “onboard” the patient by calculating an adjusted insulin infusion rate,AdjustedRate(n), based at least in part on the uncompensated insulininfusion rate (task 1014). For this example, the IOB compensation module910 may be involved during task 1014.

The IOB compensation module 910 receives at least the following items asinputs: the current insulin dose 958; and information regarding manualboluses delivered 960. The manual boluses delivered 960 may be provideddirectly or indirectly by the insulin delivery system 14, a translatordevice, a monitor device, and/or any device in the closed-loop system(see FIG. 1). This description assumes that the manual boluses delivered960 is received by the IOB compensation module 910 in an ongoing manneras it becomes available, e.g., in five minute intervals or in accordancewith any desired schedule. The IOB compensation module 910 is suitablyconfigured to estimate insulin on board based on manual bolusesdelivered, before or during closed-loop operation, in order tocompensate the final infusion rate to help avoid over-delivery ofinsulin by the controller 900. Accordingly, the output of the IOBcompensation module 910 may be a final insulin dose 962 expressed as afinal infusion rate (Units/Hour). The final insulin dose 962 is alsoreferred to herein as the adjusted insulin infusion rate,AdjustedRate(n).

Referring to FIG. 50, the control process 1000 uses the adjusted insulininfusion rate, AdjustedRate(n), to control the insulin infusion device,which in turn regulates the delivery of insulin to the body of the user(task 1016). In certain embodiments, the adjusted insulin infusion rateis communicated to the insulin infusion device in an appropriate manner(such as wireless data communication). The control process 1000 maycontinue as described above in an iterative and ongoing manner tomonitor the condition of the user and deliver insulin as needed withoutuser involvement. That said, if the control process 1000 determines thatthe closed-loop operating mode should be terminated (the “Yes” branch ofquery task 1018), then the control process 1000 causes the system toswitch back to the open-loop mode (task 1020). The closed-loop mode maybe ended in response to a user-initiated command, automatically inresponse to the detection of operating conditions that are usuallyindicative of open-loop operation, or the like.

If query task 1018 determines that the closed-loop mode should continue(the “No” branch of query task 1018), then the control process 1000 maycheck whether it is time to perform another iteration of the controlroutine. In other words, the control process 1000 may check for the nextsampling time (query task 1022). If it is time for the next iteration,then the control process 1000 may return to task 1010 and repeat thecomputations with the next set of data values. For example, the nextiteration of the control routine may obtain and process the currentvalues of some or all of the following parameters, without limitation:the SG value 940; the SG rate of change; the sensor Isig value 924; theamount of insulin delivered 954; and the manual boluses delivered 960.This allows the control process 1000 to adjust the final insulininfusion rate in an ongoing manner in accordance with a predeterminedschedule, a designated sampling rate, or the like.

The insulin delivery timeout module 912 monitors if the patient isreceiving continuous delivery of insulin at the maximum insulin limit orthe minimum allowable infusion of zero Units/Hour for a time specifiedby the controller. Accordingly, the insulin delivery timeout module 912may receive the insulin delivered 954 as an input. If the specified timeis exceeded, the system will trigger a fail-safe alert 966. Otherwise,the system remains in the closed-loop operating mode 968.

Referring back to FIG. 49, the model supervisor module 914 receives atleast the following as inputs: the insulin delivered 954; sensor Isigvalues 950; and one or more sensor calibration factors 952. The inputsto the model supervisor module 914 may be provided directly orindirectly by the insulin delivery system 14, the glucose sensor system10, a translator device, a monitor device, and/or any device in theclosed-loop system (see FIG. 1). The model supervisor module 914 issuitably designed and configured to estimate the user's glucoseconcentration in real time (or substantially real time) based on theinsulin delivered 954, the sensor Isig values 950, and the sensorcalibration factors 952. The sensor calibration factors 952 used by themodel supervisor module 914 are equal to the sensor calibration factors922 used by the closed-loop initiation module 902. That said, theclosed-loop initiation module 902 utilizes the sensor calibrationfactors 922 at one particular time, whereas the model supervisor module914 considers the sensor calibration factors 952 in an ongoing andcontinuous manner during operation in the closed-loop mode. Should themodel-predicted glucose and the sensor glucose values differsignificantly, the system will exit closed loop mode. Accordingly, themodel supervisor module 914 regulates whether the system remains in theclosed-loop mode 974 or switches to the open-loop mode 976.

The missed transmission module 916 is suitably configured to monitor thefollowing, without limitation: the sensor Isig values 950; the SG values940; and the sensor calibration factors 952. More particularly, themissed transmission module 916 continuously monitors to check whetherthe system is receiving data packets that convey the necessaryinformation and input values. For missed data packets totaling less thana lower threshold of time (e.g., 15 minutes), the system remains in theclosed-loop mode, as indicated by block 980 in FIG. 49. During thistime, the system will continue to calculate the insulin dose using theclosed-loop control methodology based on the last valid sensor glucosevalue. For missed data packets totaling a time longer than the lowerthreshold and shorter than an upper threshold of time (e.g., 60minutes), the missed transmission module 916 will switch the system to apre-programmed safe basal rate, as indicated by block 982 in FIG. 49. Incertain embodiments, this safe basal rate is defined as half thepatient's overnight basal rate, and this parameter may be programmed bya caregiver or physician. If the missed transmission module 916 startsreceiving data packets while the safe basal rate is being administered,the system will switch back to the closed-loop mode. For missed datapackets totaling more than the upper threshold of time, the system willswitch to the open-loop mode, as indicated by block 984 in FIG. 49. Atthis point, the system will be controlled to deliver a pre-programmedopen-loop overnight basal rate.

To summarize, the controller 900 determines whether to enter into theclosed-loop mode in response to at least the recent meter BG values 920,the sensor calibration factors 922, and the calibration timestamp data926. The controller 900 utilizes the closed-loop initiation module 902to check if the sensor calibration time between the last two calibrationvalues is within an acceptable range, and whether any change between thetwo calibration values (recent and prior value) is acceptable. If so,the controller 900 will switch the system into the closed-loop mode.Once the system is in the closed-loop mode, the controller 900 willperiodically receive data packets (e.g., every five minutes) thatinclude the current SG value 940, the current sensor Isig values 950,the insulin delivered 954, the sensor calibration factors 952, andmanual boluses delivered 960. In certain embodiments, each of the datapackets received by the controller 900 includes data collected duringthe previous 24-hour period.

The start-up module 904 utilizes the SG values 940 and the targetglucose setpoint value 944 to calculate the final target glucose value946. In some embodiments, the target glucose setpoint value 944 is setto 120 mg/dL, although other settings could be used if so desired (atypical range of settings may be, for example 70-300 mg/dL). Thisresults in a smoother transition between open-loop and closed-loop modesby gradually adjusting the final target glucose value 946. The finaltarget glucose value 946 is sent to the PID-IFB control module 906 foruse as one input to calculate the final insulin dose 962.

The PID-IFB control module 906 utilizes the final target glucose value946, the current and past SG values 940, the SG rate of change values,and the insulin delivered 954 to determine the insulin infusion rate(final insulin dose 962) in order to achieve euglycemia. As anadditional safeguard, the upper insulin limit (calculated based on thepatient's basal rate, fasting blood glucose, and insulin sensitivity)from the insulin limit module 908 is input into the controller 900 foreach patient to impose an upper limit to the insulin delivery rate toavoid over-delivery of insulin by the controller 900. The PID-IFBcontrol module 906 considers the upper insulin limit before sending thefinal insulin dose 962 to the IOB compensation module 910, whichestimates insulin on board from manual boluses, before or duringclosed-loop operation, in order to calculate the final insulin dose 962.The final insulin dose 962 may be communicated from the controller 900directly or indirectly to the insulin delivery system 14 such that thefinal insulin dose 962 can be delivered to the patient duringclosed-loop operation.

Additional safeguards could be implemented to monitor the system duringclosed-loop operation, such that the system exits the closed-loop modewhen certain criteria are not met. For example, the controller 900 maycause the system to exit the closed-loop mode if more than a designatednumber of consecutive data packets are missed. This assumes that thecontroller 900 usually receives data packets (from the insulin deliverysystem 14, from a monitor, from a translation device, or the like) in acontinuous manner during closed-loop operation. Thus, if the controller900 detects that more than a threshold number of consecutive datapackets are not received as expected, the system will be commanded toexit the closed-loop mode. This functionality is associated with themissed transmission module 916, as described previously.

Moreover, the model supervisor module 914 estimates the user's glucoseconcentration in an ongoing manner, based on the insulin delivered 954,the sensor Isig values 950, and the sensor calibration factors 952. Ifthe difference between the model-predicted glucose and the sensorglucose value is greater than a stated threshold, the controller 900 maycause the system to exit the closed-loop mode.

As summarized above, the controller 900 employs a number of modules orfunctions that cooperate to regulate the delivery of insulin duringclosed-loop operation: the closed-loop initiation module 902; thestart-up module 904; the PID-IFB control module 906; the insulin limitmodule 908; and the IOB compensation module 910. Moreover, thecontroller 900 may employ a number of modules that perform varioussafeguarding functions during closed-loop operation. These safeguardingmodules may include: the insulin delivery timeout module 912; the modelsupervisor module 914; and the missed transmission module 916.

Closed-Loop Initiation Module: First Representation

The closed-loop initiation module 902 checks for changes in sensorsensitivity and determines whether or not the system is allowed to enterthe closed-loop mode. Referring again to FIG. 49, the inputs to theclosed-loop initiation module 902 include the meter BG value 920, thesensor calibration factor 922, and the calibration timestamp data 926.The closed-loop initiation module 902 checks for a series of conditionspertaining to the sensor calibration factor values 922 and the timeswhen the sensor calibration factor values 922 were obtained. If all theconditions are met, the controller 900 initiates the closed-loopoperating mode. If this criteria is not met, the system remains in theopen-loop operating mode and the controller 900 requests a new sensorcalibration.

Certain embodiments of the closed-loop initiation module 902 execute oneor more functions, algorithms, or methods to determine whether or notthe system can proceed to the closed-loop mode. The following are theparameters and variables used by an exemplary embodiment of theclosed-loop initiation module 902:

-   -   t=time when attempting to enter the closed-loop mode;    -   Recent Calibration Factor (CFR)=the most recent sensor        calibration factor (CF) value;    -   tR=the time when the CFR was obtained;    -   Prior Calibration Factor (CFP)=the last CF value before the CFR;    -   tP=the time when the CFP was obtained;    -   CFchange=percentage change in CF from a previous CF to a current        CF, for any pair of CFs. The CFchange can be calculated        according to the following equation:        CFchange=(abs(CFcurrent−CFprevious)/CFprevious)*100  (eq 50)    -   tRecent=time window for the most recent calibration before        attempting to start closed-loop mode (minutes)    -   tDiffmin=minimum time difference between the recent calibration        and the calibration prior to the recent calibration (minutes)    -   tDiffmax=maximum time difference between the recent calibration        and the prior calibration (minutes)    -   CFmin=minimum acceptable CF (mg/dL per nA)    -   CFmax=maximum acceptable CF (mg/dL per nA)    -   CFprevious=the CF value before CFcurrent in the pair of CF        values    -   CFchangeTh=threshold for acceptable CFchange in % (mg/dL per nA)

In some embodiments, the closed-loop initiation module 902 isimplemented in the form of a series of processing steps. Using the logicdescribed below, the closed-loop initiation module 902 decides whetherto let the system enter the closed-loop mode.

Case A If (tP is not in the time window (tR-tDiffmin : tR)), thefollowing logic is checked. If (CFmin ≤ CFR ≤ CFmax)  If (t-tRecent ≤ tR≤ t)   If (tR-tDiffmax ≤ tP ≤ tR-tDiffmin)    If (CFmax ≤ CFP ≤ CFmax)    Calculate CFchange with CFR as the CFcurrent and     with CFP as theCFprevious in Equation 50 stated     above     If (CFchange ≤CFchangeTh)      Enter Closed Loop     Else Cannot enter closed loop atthat time    Else Cannot enter closed loop at that time   Else Cannotenter closed loop at that time  Else Cannot enter closed loop at thattime Else Cannot Enter Closed Loop

If any of the above conditions is not met, the system remains in theopen-loop mode. Thus, in order to enter the closed-loop mode, newcalibration(s) that satisfy all of the conditions in Case A (or Case Bas described below) will be required.

Case B If (tP is in the time window (tR-tDiffmin : tR)), CFV = mostrecent CF value in the time window of tR-tDiffmax : tR- tDiffmin tV =time when CFV was obtained If (CFmin ≤ CFR ≤ CFmax)  If there is a CFVavailable    Calculate CFchange with CFR as the CFcurrent and with CFV   as the CFprevious in Equation 50 stated above    If (CFV, CFR and allCF values between times tV and tR lie in    the range of (CFmin:CFmax)AND CFchange between CFV    and CFR is ≤ CFchangeTh)     Enter closedloop    Else Cannot enter closed loop at that time   Else Cannot enterclosed loop at that time  Else Cannot enter closed loop at that timeElse Cannot Enter Closed Loop

If any of the above conditions is not met, the system remains in theopen-loop mode. Thus, in order to enter the closed-loop mode, newcalibration(s) that satisfy all of the conditions in Case A or Case Bwill be required.

In accordance with certain variations of the closed-loop initiationmodule 902, the system requests a meter BG and related calibration whenentering the closed-loop mode. In such alternative embodiments,therefore, the closed-loop initiation module 902 uses the meter BG andIsig to calculate CFR. Thus, in such an implementation, the sensorcurrent would also be an input to the closed-loop initiation module 902.Accordingly, because CFR is now being calculated by the closed-loopinitiation module 902 itself, the conditions in Case A and Case B (i.e.,checking whether t-tRecent≤tR≤t) will always be met.

In particular implementations, some of the parameters mentioned abovecan be fixed. In this regard, the following values may be utilized in anexemplary embodiment. It should be appreciated that these values areprovided here for illustrative purposes only, and that an implementationof the closed-loop initiation module 902 may utilize different values ifso desired.

-   -   tRecent=120 minutes    -   tDiffmin=120 minutes    -   tDiffmax=480 minutes    -   CFmin=2.5 mg/dL per nA    -   CFmax=6 mg/dL per nA

Closed-Loop Initiation Module: Second Representation

In accordance with some embodiments, the functionality of theclosed-loop initiation module 902 can be represented as follows. Theclosed-loop initiation module 902 may be implemented in the form of aseries of case steps. In this regard, the closed-loop initiation module902 first calculates the recent calibration factor value (CFR) using themost recent meter BG and Isig values as shown in the following EquationA1:CFR=meterBG/(Isig−2)  (eq A1)Here, CFR is the recent calibration factor value, meterBG is the meterBG value, and Isig is the sensor Isig value. The “−2” in Equation A1represents a constant offset that is used by the calibration algorithmwhen calculating calibration factors and sensor glucose.

Using the logic described below for Case C or Case D, the closed-loopinitiation module 902 decides whether to let the system enter theclosed-loop mode. Each case condition is dependent upon the time atwhich the most recent prior calibration factor (CFP) was obtained.

Case C

Case C corresponds to a scenario where the time of prior calibration isgreater than 120 minutes before the most recent calibration. Inaddition, the recent calibration factor (CFR) and the prior calibrationfactor (CFP) are within limits as shown in the following logicalexpressions.CFmin≤CFR≤CFmax  (eq A2)CFmin≤CFP≤CFmax  (eq A3)Here, CFR is the recent calibration factor value, CFP is the priorcalibration value, CFmin is the minimum value for the calibration factorthat is set as 2.5 mg/dL per nA, and CFmax is the maximum value for thecalibration factor that is set as 6 mg/dL per nA.

For Case C, the time of recent calibration (tR) is within two hours ofthe start of closed-loop initiation as shown in the following logicalexpression.t−tRecent≤tR≤t  (eq A4)Here, tR is the time of recent calibration, t is the time whenattempting to enter the closed-loop mode, and tRecent is the time windowfor the most recent calibration before attempting to start theclosed-loop mode (which is set to 120 minutes).

For Case C, the time of prior calibration (tP) occurs between two andeight hours before time of recent calibration factor as shown in thefollowing logical expression.tR−tDiffmax≤tP≤tR−tDiffmin  (eq A5)Here, tP is the time of prior calibration, tR is the time when CFR wasobtained, tDiffmax is the maximum time difference between the recentcalibration and the prior calibration (which is set as 480 minutes (8hours)), and tDiffmin is the minimum time difference between the recentcalibration and the calibration prior to the recent calibration (whichis set as 120 minutes (2 hours)).

For Case C, the calibration change (CFchange) is less than 35% as shownin the following logical expression, where CFchange is calculatedaccording to Equation A6.CFchange=(abs(CFR−CFP)/CFP)×100  (eq A6)CFchange≤CFchangeTh  (eq A7)

Here, CFchange is the percentage change in calibration factor from theprevious calibration factor to a current calibration factor for any pairof calibration factors, CFchangeTh is the threshold for acceptableCFchange, (which is set to 35% for this example), CFR is the most recentcalibration factor value, and CFP is the last calibration factor valuebefore CFR.

If all of the foregoing conditions are met for Case C (Equations A2-A7),the closed-loop initiation module 902 can initiate the methodology forcalculating the correction bolus (if needed). If, however, any conditionis not met, the controller 900 remains in the open-loop mode. Thus, inorder to enter the closed-loop mode, new calibration(s) that satisfy allof the conditions in Case C or Case D will be required.

Case D

Case D corresponds to a scenario where the time of prior calibration isless than 120 minutes before the most recent calibration. If the priorcalibration is less than two hours before the recent calibration, anadditional prior calibration factor (CFP2) is included in the analysis.This allows the closed-loop initiation module 902 to evaluate sensorsensitivity that has at least a two hour time span.

For Case D, the closed-loop initiation module 902 finds an earliersecond prior calibration factor (CFP2) that occurs within two to eighthours before the time of the recent calibration factor (CFR) as shown inthe following logical expression.tR−tDiffmax≤tP2≤tR−tDiffmin  (eq A8)Here, tP2 is the time when the second prior calibration factor (CFP2) isobtained, tR is the time when CFR was obtained, tDiffmax is the maximumtime difference between tP2 and tR (which is set as 480 minutes (8hours) for this example), and tDiffmin is the minimum time differencebetween tP2 and tR (which is set as 120 minutes (2 hours) for thisexample).

For Case D, the closed-loop initiation module 902 also determines ifmore than one calibration factor (CF1 . . . CFn) is available betweenthe time of the second prior calibration factor (CFP2) and the time ofthe recent calibration factor (CFR), as shown in the following logicalexpression.tP2≤t1 . . . tn≤tR  (eq A9)Here, t1 . . . tn is the time when more calibration factors (CF1 . . .CFn) are observed, tR is the time when CFR was obtained, and tP2 is thetime when CFP2 is obtained.

For Case D, the time of recent calibration (tR) is within two hours ofthe start of closed-loop initiation, as shown in the following logicalexpression.t−tRecent≤tR≤t  (eq A10)Here, tR is the time of recent calibration, t is time when attempting toenter the closed-loop mode, and tRecent is the time window for the mostrecent calibration before attempting to start the closed-loop mode(which is set to 120 minutes for this example).

For Case D, all calibration factors including recent calibration factor(CFR), prior calibration factor (CFP), second prior calibration factor(CFP2) and CF1 . . . CFn are within limits as shown in the followinglogical expressions.CFmin≤CFR≤CFmax  (eq A11)CFmin≤CFP≤CFmax  (eq A12)CFmin≤CFP2≤CFmax  (eq A13)CFmin≤CF1 . . . CFn≤CFmax  (eq A14)Here, CFR is the recent calibration factor, CFP is the prior calibrationfactor, CFP2 is the second prior calibration factor, CF1 . . . CFn arecalibration factors obtained between tP2 and tR, CFmin is the minimumvalue for the calibration factor (which is set as 2.5 mg/dL per nA forthis example), and CFmax is the maximum value for the calibration factor(which is set as 6 mg/dL per nA for this example).

For Case D, the calibration change (CFchange) between CFR and CFP2 isless than 35%, as shown in the following logical expression whereCFchange is calculated according to Equation A15.CFchange=(abs(CFR−CFP2)/CFP2)×100  (eq A15)CFchange≤CFchangeTh  (eq A16)Here, CFchange is the percentage change in calibration factor from theprevious calibration factor to a current calibration factor for any pairof calibration factors, CFchangeTh is the threshold for acceptableCFchange (which is set to 35% for this example), CFR is the most recentcalibration factor value, and CFP2 is the most recent calibration factorvalue in the time range described in Equation A8.

If all of the foregoing conditions are met for Case D (EquationsA8-A16), the closed-loop initiation module 902 can initiate themethodology for calculating the correction bolus (if needed). If,however, any condition is not met, the controller 900 remains in theopen-loop mode. Thus, in order to enter the closed-loop mode, newcalibration(s) that satisfy all of the conditions in Case C or Case Dwill be required.

Correction Bolus With IOB Compensation

As described above, a correction bolus 932 may be commanded at thebeginning of the closed-loop mode. The purpose of the correction bolusis to provide an insulin dose for mitigating hyperglycemia at theinitiation of the closed-loop mode. This can be achieved by firstacquiring a blood glucose meter reading value immediately prior toclosed-loop initiation. If that BG meter reading value is above acertain correction threshold (CTH, which is 180 mg/dL for this example),the controller 900 will deliver an insulin dose based on the patient'sinsulin sensitivity (ISF, mg/dL/Units), insulin on board, and thedesired target glucose level (TG, mg/dL) in order to bring the subject'sglucose level to the target glucose level.

In accordance with certain implementations, the correction bolus (CB) isdelivered based on the meter BG value (in mg/dL) acquired at the startof the closed-loop mode, as shown below:

$\begin{matrix}{{CB} = \{ \begin{matrix}{{\frac{{BG} - {TG}}{ISF} - {{IOB}(n)}},} & {{if}\mspace{14mu}( {{BG} > {CTH}} )} \\{0,} & {{if}\mspace{14mu}( {{BG} \leq {CTH}} )}\end{matrix} } & ( {{eq}\mspace{14mu}{A17}} )\end{matrix}$Here, CB is the correction bolus, BG is the blood glucose meter value(mg/dL), TG is the target glucose (mg/dL), ISF (see Equation A18) is thepatient's adjusted insulin sensitivity factor (mg/dL/Units), CTH is thecorrection threshold for blood glucose beyond which a correction boluswill be delivered (mg/dL), and IOB(n) is the active insulin on boardfrom manual boluses (Units) where n is the current sampling point asdescribed previously.ISF=ISFfactor×ISF₀  (eq A18)Here, ISF is the patient's adjusted insulin sensitivity factor(mg/dL/Units), ISF₀ is the patient's established insulin sensitivityfactor (mg/dL/Units) and ISFfactor is an ISF adjusting factor (unitless). The default value for ISFfactor is set to one, which makesISF=ISF₀. However, for this particular example, ISFfactor has beenassigned as an adjustable parameter with a range of 0.5 to 2 in order toprovide greater flexibility for optimizing the patient's insulinsensitivity factor.

$\begin{matrix}{{CB} = \{ \begin{matrix}{{CB},} & {{if}\mspace{14mu}( {{CB} \geq 0} )} \\{0,} & {{if}\mspace{14mu}( {{CB} < 0} )}\end{matrix} } & ( {{eq}\mspace{14mu}{A19}} )\end{matrix}$Here, CB is the correction bolus expressed in Units. It should beappreciated that Equation A19 is utilized because the controller 900 canonly deliver positive boluses.

Start-Up Module

The start-up module 904 processes sensor glucose (SG) values 940 and thetarget glucose setpoint value 944 (which is set to 120 mg/dL in certainembodiments) to calculate the final target glucose value 946, which inturn serves as an input to the PID-IFB control module 906. Accordingly,the final target glucose value 946 is sent to the PID-IFB control module906 to calculate the final insulin dose 962. Referring again to FIG. 49,the start-up module 904 is “activated” or initiated in response to thestarting of the closed-loop mode.

At the beginning of the closed-loop operating mode, the start-up module904 calculates the difference between the current SG value 940 and thetarget glucose setpoint value 944, as indicated by Equation 51 below.

$\begin{matrix}{{{DeltaGlu}(n)} = \{ \begin{matrix}{{{{SG}(n)} - {Setpoint}},} & {m = 1} \\{0,} & {m > 1}\end{matrix} } & ( {{eq}\mspace{14mu} 51} )\end{matrix}$In Equation 51, SG is the sensor glucose value, n is the currentsampling point, Setpoint is the target glucose setpoint value defined byuser, and m is the sampling time during closed-loop operation (m=1indicates the start of the closed-loop mode, and m increases with eachsample received during the closed-loop mode). DeltaGlu(n) is forced tozero when m>1 as well as in the following situation described inEquation 52.

Force DeltaGlu to zero if it is less than a certain threshold set in thecontroller 900 (referred to as MinDeltaGlu). Otherwise, it remains asDeltaGlu(n) if it is more than the threshold set in the controller 900,as described in Equation 52:

$\begin{matrix}{{{DeltaGlu}(n)} = \{ \begin{matrix}{0,} & {{DeltaGlu} \leq {{Min}\;{DeltaGlu}}} \\{{{DeltaGlu}(n)},} & {{DeltaGlu} > {{Min}\;{DeltaGlu}}}\end{matrix} } & ( {{eq}\mspace{14mu} 52} )\end{matrix}$Here DeltaGlu is the difference between the current SG value 940 and thedefined target glucose setpoint value 944, calculated from Equation 51above, and MinDeltaGlu is the minimum difference (set in the controller900) allowable between the current SG value 940 and the target glucosesetpoint value 944.

The dynamic setpoint (DynSP) is calculated based on a discretized secondorder transfer function model as indicated in Equation 53:DynSP(n)=cd ₁·DynSP(n−1)+cd ₂·DynSP(n−2)+cn ₀·DeltaGlu(n)+cn₁·DeltaGlu(n−1)  (eq 53)Here, DynSP is the dynamic setpoint value, n is the current samplingpoint, n−1 is the last sampling point, and n−2 is the second to lastsampling point. The parameters cd₁, cd₂, cn₀, and cn₁ are thecoefficients of the setpoint model. These parameters are calculatedbased on the two time constants (τ_(sp1) and τ_(sp2)) of the setpointmodel, as indicated below:

c d₁ = eaxx 1 + eaxx 2 c d₂ = −eaxx 1 × eaxx 2 cn₀ = 1${cn}_{1} = \frac{( {{{axx}\; 1 \times {eaxx}\; 1} - {{axx}\; 2 \times {eaxx}\; 2}} )}{{daxx}\; 21}$Where: axx 1 = 1/τ_(sp 1) axx 2 = 1/τ_(sp 2) eaxx 1 = e^(−axx 1 ⋅ Ts)eaxx 2 = e^(−axx 2 ⋅ Ts) daxx 21 = axx 2 − axx 1In the above equations Ts indicates the sampling interval in minutes,and τ_(sp1) and τ_(sp2) are the time constants of the setpoint model.Moreover, axx1 is the reciprocal of the time constant τ_(sp1), axx2 isthe reciprocal of the time constant τcsp2, eaxx1 is the exponentialdecay factor for τ_(sp1), eaxx2 is the exponential decay factor forτ_(sp2), and daxx21 is the difference between the reciprocal of τ_(sp1)and τ_(sp2).

The final target glucose value 946 is obtained by adding the dynamicsetpoint value (calculated in Equation 53) with the target glucosesetpoint value 944 as shown in Equation 54:Final Target=Setpoint+DynSP(n)  (eq 54)

In particular implementations, some of the parameters mentioned abovefor the start-up module 904 can be fixed. In this regard, the followingvalues may be utilized in an exemplary embodiment. It should beappreciated that these values are provided here for illustrativepurposes only, and that an implementation of the start-up module 904 mayutilize different values if so desired.

Setpoint=120 mg/dL

MinDeltaGlu=30 mg/dL (nominal); 0 mg/dL (lower bound); 600 mg/dL (upperbound)

τ_(sp1)=25 minutes (nominal); 0.1 minute (lower bound); 250 minutes(upper bound)

τ_(sp2)=30 minutes (nominal); 0.1 minute (lower bound); 250 minutes(upper bound)

PID-IFB Control Module

The PID-IFB control module 906 calculates the insulin infusion rate(final insulin dose 962) based on the current and past sensor glucosevalues 940, the sensor Isig values 950, the rate of change of the sensorglucose values, the sensor calibration factor 952, the final targetglucose value 946, the target glucose setpoint value 944, insulin limitssuch as the upper insulin limit, and the insulin delivered 954 in orderto achieve euglycemia. In certain embodiments, the PID-IFB controlmodule 906 receives its inputs every five minutes, therefore thecalculation of the insulin feedback components considers how often theinput data is being received by the controller 900.

The PID-IFB control module 906 calculates the final insulin dose 962 inaccordance with Equation 55:u(n)=P(n)+I(n)+D(n)−γ₁ I _(SC)−γ₂ I _(P)−γ₃ I _(EFF)  (eq 55)Note that PIDRate(n)≡u(n). In Equation 55, the insulin infusion rateu(n) represents the final insulin dose 962 shown in FIG. 49. In Equation55, P(n), I(n), and D(n) are, respectively, the proportional, integral,and derivative components of the PID controller. The insulin feedbackcomponents correspond to the remaining terms. The variables γ₁, γ₂, andγ₃ represent tuning coefficients. In accordance with some embodiments,γ₁=0.64935, γ₂=0.34128, and γ₃=0.0093667, although other values may beused. The parameters I_(SC)(n), I_(P)(n), and I_(EFF)(n) correspond tothe states of the insulin pharmacokinetic model corresponding to,respectively, the subcutaneous, plasma, and effective site compartments.Therefore, the amount of insulin delivered is reduced in proportion tothe predicted insulin concentration in the different compartments.

The exemplary implementation of the control algorithm employed by thePID-IFB control module 906 is implemented in discrete (sampled) time. Inthe notation used, n is the current time step, where t=nT_(s), and t isthe continuous time (in minutes) when using a sampling period of T_(s).

The proportional component P(n) is calculated as follows:P(n)=Kp[SG(n)−Final Target(n)]  (eq 56)Here, Kp is the overall controller gain (expressed in Units/hour permg/dL), SG(n) is the current sensor glucose, n indicates the currentsampling point, and Final Target(n) is the calculated final targetglucose setpoint from Equation 54. It should be appreciated that Kp is apatient-specific value and, therefore, the actual value of Kp will varyfrom one person to another. Although the range can vary depending uponthe patient, in most typical scenarios, the value of Kp may be withinthe range of 0.008 to 0.200.

The integral component I(n) can be calculated as follows:

$\begin{matrix}{{I(n)} = {{I( {n - 1} )} + {\frac{K_{p} \cdot T_{s}}{T_{I}}\lbrack {{{SG}(n)} - {{Final}\mspace{14mu}{{Target}(n)}}} \rbrack}}} & ( {{eq}\mspace{14mu} 57} )\end{matrix}$Here, I(n−1) is the integral component from the previous sampling point,n indicates the current sampling point, n−1 indicates the previoussampling point, Kp is the overall controller gain, Ts is the samplingperiod, T_(I) is the integral time constant, SG(n) is the current sensorglucose, and Final Target(n) is the calculated final target glucosesetpoint from Equation 54.

The derivative component D (n) can be calculated as follows:D(n)=Kp×T _(D) ×dSGdt(n)  (eq 58)Here, Kp is the overall controller gain, T_(D) is the derivative timeconstant, dSGdt(n) is derivative of the sensor glucose value(pre-filtered to remove noise), and n indicates the current samplingpoint.

The parameters that need to be set (tuned) for the controller 900 are:K_(P), τ_(I), and τ_(D) (see Equations 56, 57, and 58). For the firstthree PID parameters, they will be calculated in accordance with theprevious studies mentioned below (these previous approaches haveresulted in good controller performance). The nominal (i.e., for thecase with no insulin feedback) controller gain K_(P0) is calculatedbased on the subject's insulin total daily dose I_(TDD), (in Units/day),as indicated in Equation 59:

$\begin{matrix}{K_{P0} = {( \frac{60}{( {90} )( {1500} )} )I_{TDD}}} & ( {{eq}\mspace{14mu} 59} )\end{matrix}$Here, K_(P0) is the default controller gain, and I_(TDD) is thesubject's insulin total daily dose in Units/Day.

The purpose of insulin feedback is to allow the controller 900 todeliver more insulin up-front (e.g., at the onset of a mealdisturbance), but to prevent over-infusion of insulin, in a similarfashion to the bolus estimator calculations used in existing insulinpumps to prevent the stacking of boluses. Therefore, when insulinfeedback is used, the controller gain K_(P) can be adjusted so that atsteady state (i.e., basal delivery conditions) the insulin deliverysystem will deliver the same amount of insulin as in the nominal case.This is accomplished by multiplying the nominal controller gain K_(P0)(calculated for no insulin feedback) by (1+γ₁+γ₂+γ₃) as indicated below:K _(P) =K _(P)factor·K _(P0)·(1+γ₁+γ₂+γ₃)  (eq 60)Here, K_(P) is the overall controller gain, K_(P)factor is the gainfactor for K_(P), K_(P0) is the default controller gain, γ₁ (0.64935) isa tuning coefficient for the subcutaneous insulin concentration, γ₂(0.34128) is a tuning coefficient for plasma insulin concentration, andγ₃ (0.0093667) is a tuning coefficient for effective insulinconcentration.

The integral component I(n) is also equipped with anti-windup andsaturation constraints to address integral windup issues. This isachieved by calculating an integral clip value (upper limit for theintegral component, IClip) as indicated by the following equations:

$\begin{matrix}{{{IClip}(n)} = \{ \begin{matrix}{{I\;{\max(n)}},} & ( {{{SG}(n)} > {UnwindHigh}} ) \\{{{Iramp}(n)},{( {{{SG}(n)} > {UnwindLow}} )\mspace{14mu}{and}}} & ( {{{SG}(n)} < {UnwindHigh}} ) \\{{{Ilow}(n)},} & ( {{{SG}(n)} < {UnwindLow}} )\end{matrix} } & ( {{eq}\mspace{14mu} 61} ) \\{\mspace{79mu}{{I\;{\max(n)}} = {I\;\max\;{factor} \times {Basal} \times ( {1 + \gamma_{1} + \gamma_{2} + \gamma_{3}} )}}} & ( {{eq}\mspace{14mu} 61a} )\end{matrix}$Here, Imaxfactor is the gain factor for Imax, and Basal is the subject'snight time basal rate. In accordance with these expressions, IClipbecomes equal to the Imax (which is a constant value) when the sensorglucose value is greater than an upper threshold (UnwindHigh). Incertain embodiments, the value of Imax (expressed in Units/hour) mayreach about 15. In a typical case, Imax may have a default value of 5.0.When the sensor glucose value is between the upper and lower threshold(UnwindLow), then IClip becomes equal to Iramp(n), which is calculatedas indicated in Equation 62.

$\begin{matrix}{{{Iramp}(n)} = {{Kp} \cdot \lbrack {{{SG}(n)} - {UnwindLow}} \rbrack \cdot ( \frac{{{SG}(n)} - {UnwindLow}}{{UnwindHigh} - {UnwindLow}} ) \cdot ( {{I\;\max} - {{Kp} \cdot \lbrack {{{Setpoint}(n)} - {UnwindLow}} \rbrack}} )}} & ( {{eq}\mspace{14mu} 62} )\end{matrix}$Here, Kp is is the overall controller gain, SG(n) is the current sensorglucose, UnwindLow is the sensor glucose lower threshold, UnwindHigh isthe sensor glucose upper threshold, Imax is a constant value, andSetpoint(n) is a user-defined target glucose setpoint.

Finally, if sensor glucose is below the UnwindLow threshold, IClipassumes the value of Row (n), which can be calculated by Equation 61:Ilow(n)=Kp[Setpoint(n)−Unwindlow]  (eq 63)Here, Kp is the overall controller gain, Setpoint is the target glucosedefined by the user, and UnwindLow is the sensor glucose lowerthreshold.

FIG. 51 is a graph of IClip (in Units/Hour) versus sensor glucose level(in mg/dL) in accordance with one example. FIG. 51 depicts therelationships between Imax, Ilow, UnwindLow, and UnwindHigh for thisparticular example.

The integral component I(n) as calculated in Equation 57 must be lessthan or equal to the IClip value as shown in Equation 64:

$\begin{matrix}{{I(n)} = \{ \begin{matrix}{{{IClip}(n)},} & {{I(n)} > {{IClip}(n)}} \\{{I(n)},} & {{I(n)} \leq {{IClip}(n)}}\end{matrix} } & ( {{eq}\mspace{14mu} 64} )\end{matrix}$

The insulin feedback components correspond to the remaining terms. Asmentioned above, for this particular example γ₁=0.64935, γ₂=0.34128, andγ₃=0.0093667 (the tuning coefficients), while the parameters I_(SC)(n),I_(P)(n), and I_(EFF)(n) correspond to the states of the insulinpharmacokinetic model corresponding to, respectively, the subcutaneous,plasma, and effective site compartments. Therefore, the amount ofinsulin delivered is reduced in proportion to the predicted insulinconcentration in the different compartments.

The model describing the insulin pharmacokinetics (insulin PK) is givenby the following expressions:

$\begin{matrix}{{I_{SC}(n)} = {{\alpha_{11} \times {I_{SC}( {n - 1} )}} + {\beta_{1} \times {I_{D}(n)}}}} & ( {{eq}\mspace{14mu} 65} ) \\{{where}\text{:}} & \; \\{\alpha_{11} = {\exp( {- \frac{Ts}{\tau_{s}}} )}} & ( {{eq}\mspace{14mu} 65a} ) \\{\beta_{1} = {( \frac{60}{1} ) \cdot \lbrack {1 - {\exp( {- \frac{Ts}{\tau_{s}}} )}} \rbrack}} & ( {{eq}\mspace{14mu} 65b} )\end{matrix}$

Here, Ts is the sampling time (which is five minutes for this example),and τ_(s) is the time constant for estimated subcutaneous insulin levelin minutes (which is set to 50 minutes for this example).

$\begin{matrix}{\mspace{79mu}{{I_{P}(n)} = {{\alpha_{21} \times {I_{SC}( {n - 1} )}} + {\alpha_{22} \times {I_{P}( {n - 1} )}} + {\beta_{2} \times {I_{D}(n)}}}}} & ( {{eq}\mspace{14mu} 65c} ) \\{\mspace{76mu}{{where}\text{:}}} & \; \\{\mspace{79mu}{\alpha_{21} = {\tau_{s} \cdot {\lbrack {{\exp( {- \frac{Ts}{\tau_{s}}} )} - {\exp( {- \frac{Ts}{\tau_{p}}} )}} \rbrack/( {\tau_{s} - \tau_{p}} )}}}} & ( {{eq}\mspace{14mu} 65d} ) \\{\mspace{79mu}{\alpha_{22} = {\exp( {- \frac{Ts}{\tau_{p}}} )}}} & ( {{eq}\mspace{14mu} 65e} ) \\{\beta_{2} = {( \frac{60}{1} ) \cdot {( {{\tau_{s} \cdot \lbrack {1 - {\exp( {- \frac{Ts}{\tau_{s}}} )}} \rbrack} - {\tau_{p} \cdot \lbrack {1 - {\exp( {- \frac{Ts}{\tau_{p}}} )}} \rbrack}} )/( {\tau_{s} - \tau_{p}} )}}} & ( {{eq}\mspace{14mu} 65f} )\end{matrix}$

Here, Ts is the sampling time, which is five minutes for this example,τ_(s) is the time constant for estimated subcutaneous insulin level inminutes, which is set to 50 for this example, and τ_(p) is the timeconstant for estimated plasma insulin level in minutes, which is set to70 for this example.I _(EFF)(n)=α₃₁ ×I _(SC)(n−1)+α₃₂ ×I _(P)(n−1)+α₃₃ ×I _(EFF)(n−1)+β₃ ×I_(D)(n)   (eq 66)

For Equation 66:

$\begin{matrix}{\alpha_{31} = {\tau_{s} \cdot {\lbrack {{\tau_{s} \cdot ( {\tau_{p} - \tau_{e}} ) \cdot {\exp( {- \frac{Ts}{\tau_{s}}} )}} - {\tau_{p} \cdot ( {\tau_{p} - \tau_{e}} ) \cdot {\exp( {- \frac{Ts}{\tau_{p}}} )}} + {\tau_{e} \cdot ( {\tau_{s} - \tau_{p}} ) \cdot {\exp( {- \frac{Ts}{\tau_{e}}} )}}} \rbrack/\lbrack {( {\tau_{s} - \tau_{p}} ) \cdot ( {\tau_{s} - \tau_{e}} ) \cdot ( {\tau_{p} - \tau_{e}} )} \rbrack}}} & ( {{eq}\mspace{14mu} 66a} ) \\{\mspace{79mu}{\alpha_{32} = {\tau_{p} \cdot {\lbrack {{\exp( {- \frac{Ts}{\tau_{p}}} )} - {\exp( {- \frac{Ts}{\tau_{e}}} )}} \rbrack/( {\tau_{p} - \tau_{e}} )}}}} & ( {{eq}\mspace{14mu} 66b} ) \\{\mspace{79mu}{\alpha_{33} = {\exp( {- \frac{Ts}{\tau_{e}}} )}}} & ( {{eq}\mspace{14mu} 66c} ) \\{\beta_{3} = {( \frac{60}{1} ) \cdot {( {\lbrack {\tau_{s}^{2} \cdot ( {\tau_{p} - \tau_{e}} ) \cdot ( {1 - {\exp( {- \frac{Ts}{\tau_{s}}} )}} )} \rbrack - {\tau_{p}^{2} \cdot ( {\tau_{s} - \tau_{e}} ) \cdot \lbrack {1 - {\exp( {- \frac{Ts}{\tau_{p}}} )}} \rbrack} + {\tau_{e}^{2} \cdot ( {\tau_{s} - \tau_{p}} ) \cdot \lbrack {1 - {\exp( {- \frac{Ts}{\tau_{e}}} )}} \rbrack}} )/( {\tau_{s} - \tau_{p}} )} \cdot ( {\tau_{s} - \tau_{e}} ) \cdot ( {\tau_{p} - \tau_{e}} )}} & ( {{eq}\mspace{14mu} 66d} )\end{matrix}$Here, Ts is the sampling time, which is five minutes for this example,τ_(s) is the time constant for estimated subcutaneous insulin level inminutes, which is set to 50 for this example, τ_(p) is the time constantfor estimated plasma insulin level in minutes, which is set to 70 forthis example, and τ_(e) is the time constant for estimated interstitialinsulin level in minutes, which is set to 55 for this example.

ID(n) is the calculated and administered insulin infusion.

The notation (n−1) indicates values at the previous time step.

I_(SC) is the subcutaneous insulin model estimate/prediction.

I_(P) is the plasma insulin model estimate/prediction.

I_(EFF) is the effective site insulin model estimate/prediction.

For this particular example, the insulin PK model parameters α₁₁, α₂₁,α₂₂, α₃₁, α₃₂, α₃₃, β₁, β₂, and β₃ are set to 0.9802, 0.014043, 0.98582,0.000127, 0.017889, 0.98198, 1.1881, 0.0084741, and 0.00005,respectively. These values were calculated from PK-PD data for insulinas part of an empirical study and investigation. It should beappreciated that the specific values presented here merely reflect onepossible set of suitable values, and that any one or more of thesevalues may be adjusted as appropriate for the particular embodiment.

Insulin Limit

The final infusion rate as calculated by Equation 55 is limited suchthat is does not exceed the maximum upper insulin limit (Umax) asindicated below in Equation 67:

$\begin{matrix}{{u(n)} = \{ \begin{matrix}{{U\max},} & {{u(n)} > {U\;\max}} \\{{u(n)},} & {{u(n)} \leq {U\;\max}}\end{matrix} } & ( {{eq}\mspace{14mu} 67} )\end{matrix}$Umax is calculated as indicated by Equation 68:

$\begin{matrix}{{U\;\max} = {I_{{basal},0} + \frac{{BG}_{LBL} - {FBG}_{0}}{KI}}} & ( {{eq}\mspace{14mu} 68} )\end{matrix}$Here, Umax is the upper insulin limit bounded at BG_(LBL) (see Equation68a below), and I_(basal,0) is the basal rate defined for the user tobring the patient to a Fasting Blood Glucose (FBG) of the value FBG₀mg/dL. BG_(LBL) (mg/dL) is the lower buffer limit BG when reaching Umax,FBG₀ is the estimated blood glucose using meter blood glucose readingsat the end of the night period, and KI is insulin gain as calculated byEquation 69 below.BG_(LBL)=Setpoint−ILB  (eq 68a)Here, BG_(LBL) (mg/dL) is the lower buffer limit BG when reaching Umax,Setpoint is the target glucose setpoint value 944 (FIG. 49) that isdefined by the user, and ILB is the insulin limit buffer, which is anamount (in mg/dL) that the system allows as an additional buffer tohandle higher insulin needs. For example, an ILB of 50 allows the systemto deliver additional insulin to lower by 50 mg/dL from the Setpoint.

$\begin{matrix}{{KI} = {{- {IS}} \star {3( {\frac{mg}{dL}\mspace{14mu}{per}\mspace{14mu}\frac{U}{h}} )}}} & ( {{eq}\mspace{14mu} 69} )\end{matrix}$Here, KI is insulin gain, and IS is the insulin sensitivity estimated bythe 1800 rule as IS=1800/TDI (Total Daily Insulin). In certainembodiments, the value of Umax may reach 150 Units/hour. In a typicalimplementation, the value of Umax is calculated on a per-patient basis,and the typical range for Umax is between 0.5 to 3.0 Units/hour.

Moreover, if the insulin limit is active, then the integral component ofthe PID algorithm is frozen to its previous value. This feature can beemployed to assist in the prevention of integral wind up. Thisinformation is passed back to the PID-IFB control module 906 for useduring the next PID calculation.

$\begin{matrix}{{I(n)} = \{ \begin{matrix}{{I( {n - 1} )},} & {{u(n)} = {U\;\max}} \\{{I(n)},} & {{u(n)} < {U\;\max}}\end{matrix} } & ( {{eq}\mspace{14mu} 70} )\end{matrix}$

As mentioned above, previous studies may be leveraged for purposes ofconfiguring and/or operating the PID-IFB control module 906. A firststudy (Study 1; Panteleon et al., 2006) looked at the effect of changingthe controller gain in a study on eight diabetic dogs. The nominal gainwas calculated based on the total daily dose of insulin for oneexperiment; in duplicate experiments this nominal gain was increased anddecreased by fifty percent. Insulin delivery in the six-hourpostprandial period tended to increase with increasing gain, but thisdid not achieve statistical significance. This was due to feedback, withlower insulin delivered as glucose levels fell. In essence, the highergains tended to give more insulin earlier (achieving much better glucoseregulation), and reducing the infusion later, whereas the lower gainstended to keep insulin infusion above basal for a longer period of timedue to the glucose levels remaining significantly above target. Notethat the controller gain affects all of the components of the PIDalgorithm, including the integral and derivative terms.

A second study (Study 2; Steil et al., 2006) applied a PID controller toten human subjects. In this study the nominal controller gain was about42 percent higher than that proposed here, with the integral timeconstants the same (therefore also a higher integral response), butslightly lower derivative time constants (defined in terms of rising orfalling blood glucose, instead of day or night response). In theproposed embodiment presented here, the night-time derivative timeconstant is just slightly lower than that used in Study 2.

A third study (Study 3; Weinzimer et al., 2008) applied a PID controllerto seventeen human subjects. For a subset of eight subjects, no pre-mealbolus was given, while in the remaining nine subjects about 50 percentof the standard meal bolus was given about fifteen minutes before themeal. The controller tuning was the same as that proposed herein. Inboth cases, performance was acceptable, with the pre-meal bolus helpingto lower the postprandial peak glucose excursion. When compared withhome treatment using standard pump therapy, both closed-loop algorithmswere superior, reducing both glucose excursions above 180 mg/dl andbelow 70 mg/dl.

One of the observations from Study 3 was that the meal-related insulininfusion persisted above pre-meal levels for at least four hours afterthe meal. This result led to the introduction of insulin feedback to thealgorithm, which serves to compensate for insulin already delivered,while at the same time allowing for more aggressive action at the startof meals, where it is needed.

In particular implementations, some of the parameters mentioned abovefor the PID-IFB control module 906 can be fixed. In this regard, thefollowing values may be utilized in an exemplary embodiment. It shouldbe appreciated that these values are provided here for illustrativepurposes only, and that an implementation of the PID-IFB control module906 may utilize different values if so desired.

-   -   γ₁=0.64935    -   γ₂=0.34128    -   γ₃=0.0093667    -   α₁₁=0.90483741803596    -   α₂₁=0.065563404170158    -   α₂₂=0.931062779704023    -   α₃₁=0.00297495042963571    -   α₃₂=0.083822962634882    -   α₃₃=0.083822962634882    -   β₁=5.70975491784243    -   β₂=0.202428967549153    -   β₃=0.202428967549153

The values of the PID parameters mentioned above (K_(P), τ_(I), andτ_(D)) are not expected to change, but it may be desirable to adjustthem if doing so would improve the response of the glucose excursion.The nominal values for these PID parameters, together with exemplaryallowable ranges, are shown in Table 2.

TABLE 2 Adjustable Parameters For the PID-IFB Control Module ParameterNominal Value Lower Bound Upper Bound Controller gain: 1 × K_(P0) × (1 +0.05 × K_(P0) × (1 + 20 × K_(P0) × (1 + K_(P) γ₁ + γ₂ + γ₃) γ₁ + γ₂ +γ₃) γ₁ + γ₂ + γ₃) Integral time 250 min 10 min 1500 min constant: τ_(I)Derivative time  75 min 10 min  500 min constant: τ_(D) UnwindLow 80 0200 (mg/dL) UnwindHigh 100 0 200 (mg/dL) Imax 2.5 × (1 + γ₁ + 0 10 ×(1 + γ₁ + γ₂ + γ₃) × γ₂ + γ₃) × Basal Rate Basal Rate

The lower bound for the controller gain K_(P0) would lower it by 95percent from the nominal, resulting in an overall less aggressiveresponse of the controller 900, and resulting in less insulin deliveredfor the same glucose level and trend. The upper bound allows this gainto be increased up to 20 times from the nominal. Although this wouldresult in more insulin being given, this is always with respect to theactual glucose level and its derivative, rapidly falling blood glucose,even with an elevated blood glucose level, results in a decreaseddelivery of insulin due to the derivative component.

The integral time constant τ_(I) determines how fast a deviation in theblood glucose from the desired glucose target accumulates. A highervalue results in a slower response to persistent deviations in glucosefrom target. Lastly, the derivative time constant τ_(D) can safely bedecreased all the way to zero, as the lower it is the less insulin willbe delivered. Anything much higher than the upper bound of 500 minuteswould make the controller too sensitive to small changes in the rate ofchange of the sensor glucose, which even though it is not necessarilydangerous, is still undesirable in terms of overall performance.

IOB Compensation Module

FIG. 52 is a block diagram that schematically depicts one suitableembodiment of the IOB compensation module 910 in additional detail. Asmentioned briefly above, the IOB compensation module 910 adjusts thecurrent insulin dose 936 (i.e., the insulin infusion rate as computed bythe PID-IFB control module 906) as needed to generate the final insulindose 962 (i.e., the final adjusted infusion rate used by the insulininfusion device). The IOB compensation module 910 may also receive basalrate data 990 and the information related to the manual bolusesdelivered 960 as input for purposes of calculating the current value ofthe final insulin dose 962 and/or for purposes of calculating futurevalues of the final insulin dose 962. The basal rate data 990 mayindicate the current basal rate of insulin being delivered to the user,and the manual boluses delivered 960 may indicate the amount for eachbolus administered to the user, along with timestamp data correspondingto the delivery date/time of each bolus. In this regard, the manualboluses delivered 960 may include information for any number of bolusesdelivered in the past, and the manual boluses delivered 960 can beupdated as needed in response to each bolus that is delivered goingforward. Moreover, the basal rate could be dynamically adjusted ifneeded or desired (automatically by the system, by the user, by acaregiver, etc.).

The manual boluses delivered 960 may be collected and saved inassociation with the IOB compensation module 910 for use as bolushistory 992. In this regard, the bolus history 992 may include anynumber of past bolus amounts administered during a given period of time.The IOB compensation module 910 may also use a number of constants,parameters, coefficients, configuration settings, gain values, or thelike (for simplicity, the constants 994 shown in FIG. 52 are intended toencompass these and any other quantities that might be used by the IOBcompensation module 910 to calculate the final insulin dose 962. FIG. 52also depicts IOB history 996, which represents previously calculated IOBvalues (i.e., historical IOB values calculated for past sampling times).As explained in more detail below, the IOB history 996 and the bolushistory 992 may influence the determination of the final insulin dose962. It should be appreciated that the bolus history 992, the constants994, and the IOB history 996 can be stored and maintained in one or morememory storage elements of the host system. FIG. 52 shows these dataitems “inside” the IOB compensation module 910 for simplicity and easeof description.

The IOB compensation module 910 provides an additional safeguard thatestimates the insulin on board the body of the patient from manualboluses that were delivered prior to activation of the closed-loop mode,to compensate the final insulin dose 962 and help avoid over-delivery ofinsulin. When the system initially enters the closed-loop mode, the IOBcompensation module 910 considers the manual boluses delivered 960 thathave been administered over a defined period of time (e.g., the lasteight hours), and subtracts the manual boluses. Thereafter, during theclosed-loop mode, the IOB compensation module adjusts for manual bolusesthat were delivered during each sampling period (e.g., every fiveminutes).

FIG. 53 is a flow chart that illustrates an exemplary embodiment of anIOB compensation process 1100, which may be performed by the IOBcompensation module 910. The process 1100 represents one iteration thatis performed for a current sampling point or time, n. Accordingly, theprocess 1100 receives, obtains, or accesses a variety of inputs that mayhave an influence on the output of the IOB compensation module (task1102). For example, the process 1100 may utilize the current value ofthe uncompensated insulin infusion rate, PIDRate(n), as generated by thePID-IFB control module 906. The process 1100 may also use the currentbasal rate (provided with the basal rate data 990), some of the bolushistory 992, and/or some of the IOB history 996 as needed.

In the context of the process 1100, the IOB compensation module 910calculates insulin on board from manual boluses at each cycle andcompensates the controller output rate (insulin infusion rate) if activeIOB is greater than a certain threshold. Accordingly, the process 1100calculates, generates, or otherwise obtains a current IOB value (task1104) that represents an estimate of active insulin in the body of theuser. In certain embodiments, the active IOB is estimated in accordancewith a discretized three-compartment insulin pharmacokinetic (PK) model,as indicated below:IOB(n)=ci ₁·IOB(n−1)+ci ₂·IOB(n−2)+ci ₃·IOB(n−3)+cb ₀·Ubolus(n)+cb₁·Ubolus(n−1)+cb ₂·Ubolus(n−2)  (eq 71)

Here, IOB is the active insulin on board, Ubolus is the amount of manualbolus delivered in units per sample, n is the current sampling point,n−1 is the last sampling point, n−2 is the second to last samplingpoint, and n−3 is the third to last sampling point. Accordingly, theprocess 1100 obtains the current IOB value, IOB(n), based at least inpart on historical bolus delivery data for the user (see the manualboluses delivered 960 and the bolus history 992 in FIG. 52). Theparameters ci₁, ci₂, ci₃, cb₀, cb₁, and cb₂ are the coefficients of theinsulin absorption model. These parameters are calculated based on thethree time constants (τ_(sc), τ_(p), and τ_(eff)) of the insulinpharmacokinetic model, as indicated below:ci ₁ =eaxx3+eaxx4+eaxx5  (eq 71a)ci ₂=−(eaxx3×eaxx4+(eaxx3+eaxx4)×eaxx5)  (eq 71b)ci ₃ =eaxx3×eaxx4×eaxx5  (eq 71c)cb ₀=1cb ₁=dprod×(−(daxx22×eaxx3+daxx22×eaxx4)×axx3×axx4+(daxx31×eaxx3+daxx31×eaxx5)×axx3×axx5−(daxx32×eaxx4+daxx32×eaxx5)×axx4×axx5)  (eq71d)cb ₂=dprod×(daxx22×eaxx3×eaxx4×axx3×axx4+daxx32×eaxx4×eaxx5×axx4×axx5−daxx31×eaxx3×eaxx5×axx3×axx5)  (eq71e)Where:axx3=1/τ_(SC)  (eq 71f)axx4=1/τ_(p)  (eq 71g)axx5=1/τ_(eff)  (eq 71h)eaxx3=e ^(−axx3·TsC)  (eq 71i)eaxx4=e ^(−axx4·TsC)  (eq 71j)eaxx5=e ^(−axx5·TsC)  (eq 71k)daxx22=axx4−axx3  (eq 71l)daxx31=axx5−axx3  (eq 71m)daxx32=axx5−axx4  (eq 71n)dprod=−1/(daxx22×daxx31×daxx32)  (eq 71o)In the above equations TsC indicates a modified sampling interval inminutes, which can be calculated as TsC=Ts*6/CurveSpeed, where Ts is thesampling interval and CurveSpeed is the insulin on board decay speedrate in hours. τ_(SC), τ_(p), and τ_(eff) are the respective timeconstants of the subcutaneous, plasma, and effective compartments of theinsulin PK model.

IOB (in Units) as calculated by Equation 71 represents the residualactive insulin in the body from manual boluses (that may have beenadministered before the start of the closed-loop mode or duringclosed-loop operation) which must be taken into account for calculationof the final insulin delivery rate. This is achieved by firstcalculating the IOB rate (task 1106) and then deducting the IOB ratefrom the PID-IFB calculated infusion rate, as indicated below.Accordingly, in certain situations the process 1100 determines anadjusted insulin infusion rate (task 1108) based at least in part on thecalculated IOB rate and the uncompensated insulin infusion rate,PIDRate(n):

$\begin{matrix}{{{{IOB}{Rate}}(n)} = \{ \begin{matrix}{{{GainIOB} \times {{IOB}(n)}},} & {{{IOB}(n)} > {{Min}\;{IOB}}} \\{0,} & {{{IOB}(n)} \leq {{Min}\;{IOB}}}\end{matrix} } & ( {{eq}\mspace{14mu} 72} ) \\{{{AdjustedRate}(n)} = {\max( {0,{{{{PIDR}{ate}}(n)} - {{{IOBR}{ate}}(n)}}} )}} & ( {{eq}\mspace{14mu} 73} )\end{matrix}$Note that the process 1100 calculates the IOB rate, IOBRate(n), based atleast in part on the current IOB value, IOB(n). The IOB rate, which isexpressed in Units per hour (U/h), represents the amount of activeinsulin accumulated from manual boluses in the body per unit of time.Hence, this additional insulin which is already present in the body isdeducted from the controller delivery rate (PIDRate). This accounts forall the manual boluses that have been administered by the user, andminimizes the possibility of over-delivery by the controller. Here,GainIOB is the IOB decay rate in h⁻¹, and MinIOB is the minimum IOBrequired to compensate the PIDRate (where MinIOB is expressed in Units).Thus, the IOB rate is calculated to be equal to the current IOB valuemultiplied by an IOB decay rate when the current IOB value is greaterthan a minimum IOB value, and is calculated to be equal to zero when thecurrent IOB value is less than or equal to the minimum IOB value. Inthis regard, MinIOB is a minimum threshold for JOB, below which theeffect of IOB on glucose is considered to be negligible; hence notneeded to be compensated.

As reflected in Equation 73, the process 1100 selects the adjustedinsulin infusion rate to be the maximum of zero or the differencebetween the uncompensated insulin infusion rate and the calculated IOBrate (from task 1106). Note that the difference between PIDRate andIOBRate could be negative, as these values are calculated from differentsources. PIDRate is the controller calculated infusion rate and IOBRateis the accumulated active insulin in the body obtained from manualboluses. Accordingly, Equation 73 ensures that the AdjustedRate does notfall below zero.

Next, the process 1100 may calculate, select, or otherwise determine afinal insulin infusion rate (task 1110). In certain embodiments, thefinal insulin infusion rate (the final insulin dose 962 in FIG. 49) iscalculated as indicated below:

$\begin{matrix}{{{FinalRate}(n)} = \{ \begin{matrix}{{\max( {{Basal},{{AdjustedRate}\mspace{14mu}(n)}} )},} & {{{PIDR}{ate}} > {Basal}} \\{{{{PIDR}{ate}}\mspace{14mu}(n)},} & {{{PIDR}{ate}} \leq {Basal}}\end{matrix} } & ( {{eq}\mspace{14mu} 74} )\end{matrix}$As indicated by this expression, the process 1100 selects either theadjusted insulin infusion rate (AdjustedRate(n)), the uncompensatedinsulin infusion rate (PIDRate(n)), or the current basal rate (Basal) toserve as the final insulin infusion rate (FinalRate(n)) for the insulininfusion device. Here, PIDRate is the insulin infusion rate ascalculated by the PID-IFB control module 906 and Basal is the currentpre-programmed pump basal rate. Accordingly, task 1110 selects the finalinsulin infusion rate to be equal to the uncompensated insulin infusionrate when the current basal rate is greater than or equal to theuncompensated insulin infusion rate. In contrast, when the current basalrate is less than the uncompensated insulin infusion rate, task 1110selects the final insulin infusion rate to be either the current basalrate or the adjusted insulin infusion rate, whichever is higher.

In the context of task 1110, the PIDRate is used as the FinalRate (whenPIDRate is less than or equal to Basal) to allow the controller to“apply brakes” (in other words, suppress insulin delivery rate) in orderto prevent any potential hypoglycemia. On the other hand, when PIDRateis greater than Basal, the FinalRate will be the maximum of Basal orAdjustedRate, which ensures that the insulin adjustment only accountsfor the insulin coming from boluses, and not the basal. A lower bound(i.e., the value of Basal) is applied to the FinalRate when PIDRate isgreater than Basal; this lower bound is utilized to preventover-compensation of insulin on board under these circumstances.

The process 1100 may continue by communicating or otherwise providingthe final insulin infusion rate, FinalRate(n), to the insulin infusiondevice (task 1112). For embodiments where the process 1100 is executednatively by the insulin infusion device itself, then the process 1100may simply provide the final insulin infusion rate to the processinglogic or fluid delivery control module of the infusion device. In turn,the insulin infusion device responds by regulating delivery of insulinin accordance with the final insulin infusion rate.

This description assumes that the process 1100 is repeated for eachsampling time. For the next sampling time, therefore, the value of n maybe incremented by one (or by any desired amount) to establish an indexfor the next iteration of the process 1100 (task 1114). Thereafter, theprocess 1100 may return to task 1102 to obtain the newest input datavalues and to repeat the various tasks described above. Accordingly, theprocess 1100 facilitates regulation of insulin delivery to the body ofthe user in a controlled and ongoing manner by continuously adjustingthe final insulin infusion rate while the system is operating in theclosed-loop mode.

In certain embodiments, it may be desirable to adjust some of theparameters utilized by the IOB compensation module 910 if doing so wouldimprove performance. The nominal values for these parameters, togetherwith exemplary allowable ranges, are shown in Table 3.

TABLE 3 Adjustable Parameters For the IOB Compensation Module ParameterNominal Value Lower Bound Upper Bound Curve Speed 6 1 8 GainIOB 1.25 0 5MinIOB 1 0 500

Insulin Delivery Timeout Module

The insulin delivery timeout module 912 is suitably designed andconfigured to continuously monitor (during the closed-loop mode) if thepatient is receiving insulin at the insulin limit (Umax) or no insulin(Umin, which may be defined as insulin delivery at little to noUnits/Hour) for a prolonged period of time. If one of these insulindelivery conditions is detected, the system will issue a warning andcontinue operating under the closed-loop mode. As mentioned previously,the insulin delivery timeout module 912 may process the insulindelivered 960 as an input.

Accordingly, the insulin delivery timeout module 912 introduces anadditional safeguard that checks for a series of steps as describedbelow for the delivery of insulin at the insulin limit (Umax Timeout) orno insulin (Umin Timeout) for a prolonged period of time. This isachieved by calculating the total amount of insulin delivered by thesystem during the closed-loop mode in a pre-specified moving window thatis identified as the insulin time window.

Regarding the Umin Timeout condition, once the insulin time window forUmin (which may be defined as delivering insulin at zero Units/Hour) hasbeen reached from the start of the closed-loop mode, the system willmonitor the amount of insulin being delivered at the user specifiedinsulin time window and compare it with the amount that could have beendelivered if operating at the patient's basal rate for the same timespan, as shown in the following logical expression.

$\begin{matrix}{{{Pump}\mspace{14mu}{Delivery}\mspace{14mu}{Rate}} = \{ \begin{matrix}{{FinalRate},} & {{{if}{\mspace{14mu}\;}U_{Tot}^{WinMin}} > {( {{Min}\;{{DeliveryTol}/100}} ) \times U_{Basal}^{WinMin}}} \\{{Alert},} & {{{if}\mspace{14mu} U_{Tot}^{WinMin}} \leq {( {{Min}\;{{DeliveryTol}/100}} ) \times U_{Basal}^{WinMin}}}\end{matrix} } & ( {{eq}\mspace{14mu} 75} )\end{matrix}$Here, Pump Delivery Rate (Units/Hour) is the infusion rate, which iseither equal to the FinalRate from Equation 74 (i.e., the infusion ratecalculated by the controller during the closed-loop mode), or apre-programmed overnight basal rate that is used during open-loopoperation. The quantity U_(Tot) ^(WinMin) is the total amount of insulindelivered (in Units) by the closed-loop control algorithm in auser-specified insulin time window for Umin, and the quantity U_(Basal)^(WinMin) is the total amount of insulin that could be delivered ifoperating at a pre-programmed overnight basal rate in the same insulintime window for Umin. The parameter MinDeliveryTol is a user-specifiedtolerance, in percentage of U_(Basal) ^(WinMin), that the system has todeliver in order to stay in the closed-loop mode.

In accordance with this particular example, closed-loop controlcontinues as long as the total amount of insulin delivered during theinsulin time window (which is set to 120 minutes for this example) bythe system is greater than the total amount of insulin that might havebeen delivered if operating at five percent (which is the defaultminimum tolerance for this example) of basal. Moreover, a fail-safealert is triggered once the total amount of insulin delivered during theinsulin time window (120 minutes) by the system is less than fivepercent of basal.

Regarding the Umax Timeout condition, once the insulin time window forUmax has been reached from the start of the closed-loop mode, the systemwill monitor the amount of insulin being delivered at the user specifiedinsulin time window and compare it with the amount that might bedelivered if operating at the Umax rate for the same time span, as shownin the following logical expression.

$\begin{matrix}{{{Pump}\mspace{14mu}{Delivery}\mspace{14mu}{Rate}} = \{ \begin{matrix}{{FinalRate},} & {{{if}{\mspace{14mu}\;}U_{Tot}^{WinMax}} < {( {{Max}\;{{DeliveryTol}/100}} ) \times U_{\max\;}^{WinMax}}} \\{{Alert},} & {{{if}\mspace{14mu} U_{Tot}^{WinMax}} \geq {( {{Max}\;{{DeliveryTol}/100}} ) \times U_{\max}^{WinMax}}}\end{matrix} } & ( {{eq}\mspace{14mu} 76} )\end{matrix}$Here, Pump Delivery Rate is the infusion rate, which is equal to eitherthe FinalRate or a pre-programmed overnight basal rate that is usedduring operation in the open-loop mode. The quantity U_(Tot) ^(WinMax)is the total amount of insulin delivered (in Units) by the closed-loopcontrol algorithm in a user-specified insulin time window for Umax, andthe quantity U_(max) ^(WinMax) is the total amount of insulin that couldhave been delivered in the user-specified moving window for Umax ifoperating at a calculated Umax rate. The parameter MaxDeliveryTol is auser-specified tolerance, in percentage of U_(max) ^(WinMax) that thesystem must adhere to in order to stay in the closed-loop mode.

In accordance with this particular example, closed-loop controlcontinues as long as the total amount of insulin delivered during theinsulin time window (which is set to 600 minutes for this example) bythe system is less than the total amount of insulin that might have beendelivered if operating at 95% (which is the default maximum tolerancefor this example) of Umax. Moreover, a fail-safe alert is triggered oncethe total amount of insulin delivered during the insulin time window(600 minutes) by the system is greater than the total amount that mighthave been delivered if operating at 95% of Umax.

In certain embodiments, it may be desirable to adjust some of theparameters utilized by the insulin delivery timeout module 912 if doingso would improve performance. The nominal values for these parameters,together with exemplary allowable ranges, are shown in Table 4.

TABLE 4 Adjustable Parameters For the Insulin Delivery Timeout ModuleNominal Lower Upper Parameter Value Bound Bound Insulin Time Window forUmin 120 minutes 30 minutes 600 minutes Insulin Time Window for Umax 600minutes 30 minutes 600 minutes MinDeliveryTol  5% 0% 100% MaxDeliveryTol95% 0% 100%

Model Supervisor Module

The model supervisor module 914 is similar to the insulin deliverytimeout module 912 in that it monitors and polices the system duringclosed-loop operation. In practice, closed-loop systems are only awareof signals (inputs) that are being provided by the measurementdevice(s). If measurements deviate from true values, the control systemmay react to the deviation. When using continuous glucose sensors fordiabetes, the sensors provide the measurements to the closed-loopcontrol system and, based on these measurements, insulin is delivered tothe subject. Accordingly, sensor performance and integrity should beclosely monitored. Fortunately, there is a relationship between theinsulin and meal intake to the glycemic response. This relationship canbe translated into a mathematical model that is able to predict thesensor glucose response based upon the insulin delivered. Thesensitivity of sensor glucose to insulin delivered is patient-specific(the sensitivity can usually be learned over a period of three to sixdays for each patient).

The model supervisor module 914 uses a mathematical model that enablesindividualization of a patient's unique blood glucose time-dependentresponse. The model describes the sensor glucose time-dependent responseas a function of insulin and meal intake. The exemplary mathematicalmodel described herein has a number of benefits and advantages: it islinear, physiologically-based, and includes only parameters that havedirect connection to measurable data (sensor glucose and insulindelivered). These features are important because a linear model is easyto analyze and predict. Moreover, a physiological-based modelfacilitates an understanding of the origin of the predictions (e.g.,insulin sensitivity, meal intake, etc.), and use of measureable datareduces the need to estimate unobserved variables (e.g., metabolism,cell activity, etc.).

FIG. 54 is a diagram that defines certain time events for the modelsupervision. The label “present” indicates the most recent sampling timeor sampling period 1120, and k is equal to the present sampling timeminus a period corresponding to a length of prediction horizon (LPH) insampling times. FIG. 54 also indicates a period corresponding to alength of training horizon (LTH) in sampling times, which refers to amodel training period. Insulin history is defined as the length of dataneeded to estimate the plasma insulin. In order for the model supervisormodule 914 to be able to estimate a fault, it considers the records ofthe insulin delivered over the past insulin history plus the LTH and theLPH sampling periods, and at least 80 percent of the Isig (electricalsignal) measurements from k-LTH and k.

As described in more detail below, the model supervisor module 914considers a “moving window” that includes a historical time period 1122that is defined from the present (most recent sampling period 1120) backto the beginning of the LTH. The moving window considered by the modelsupervisor module 914 may also include insulin history that precedes theLTH, as depicted in FIG. 54. Data obtained during each window of time isprocessed and analyzed at or near the present time and preferably beforethe next sampling period has ended. Thus, at the end of each newsampling period, the “moving window” shifts by one sampling period suchthat the model supervisor module 914 can consider the most recentlyobtained data for the current sampling period while disregarding thedata that no longer appears within the updated window of time (i.e., theoldest data is no longer considered). The historical time period 1122may be defined by the LTH and the LPH, which for this exampleimmediately follows the LTH (as shown in FIG. 54). The LPH may also bereferred to herein as the “recent history period” or the “modelprediction period” for reasons that will become apparent from thefollowing description. The LTH may also be referred to herein as the“distant history period” or the “model training period” for reasons thatwill become apparent from the following description. In this regard, theLTH (distant history period) corresponds to a period of time from abegin-training sampling period 1124 to an end-training sampling period1126, inclusive, while the LPH (recent history period) corresponds to aperiod of time from a begin-prediction sampling period 1128 to the mostrecent sampling period 1120, inclusive. Accordingly, by definition thecurrent sampling period (i.e., the most recent sampling period 1120)resides within the LPH. For this particular example, thebegin-prediction sampling period 1128 corresponds to the end-trainingsampling period 1126. Alternatively, the begin-prediction samplingperiod 1128 may immediately follow the end-training sampling period1126.

FIG. 55 is a flow chart that illustrates an exemplary embodiment of asensor model supervision process 1150, which may be performed by themodel supervisor module 914. The process 1150 is shown and described ina simplified manner that focuses on functionality for ease ofunderstanding. Certain aspects of the process 1150 are addressed in moredetail below with reference to particular representations of the modelsupervisor module 914.

The process 1150 represents one iteration that is performed for acurrent sampling point or time, which corresponds to the most recentsampling period. This example assumes that the insulin infusion deviceis already operating in the closed-loop mode (task 1152) to deliverinsulin to the body of the user, and that the process 1150 receivesrelevant data in accordance with a predetermined schedule (e.g., asampling period of five minutes). Accordingly, the process 1150receives, obtains, or accesses a variety of inputs that may have aninfluence on the operation of the model supervisor module 914 (task1154). For example, the process 1150 may receive at least the followingdata for the current sampling period: current insulin-delivered datathat indicates an amount of insulin delivered by the insulin infusiondevice during the most recent sampling period; current sensor data thatindicates a current sensor glucose value for the user, which correspondsto the most recent sampling period; and a current sensor calibrationfactor, which may be needed to compensate for recent meter-basedcalibrations. Any amount of historical data could also be receivedduring task 1154 if so desired. Thus, some amount of redundancy may bebuilt into the system (which may be desirable to account for missedtransmissions, lost packets, or the like). The sensor data may bereceived and processed in any suitable form. For example, a continuousglucose sensor may generate Isig (electrical current) values that can bemapped to sensor glucose values. The model supervisor module 914 may besuitably configured to process Isig values directly, or it couldtranslate or map the raw Isig values into any desired representation.

The process 1150 may also access or retrieve historical data that wasreceived for past sampling periods (task 1156). Task 1156 may representan initialization routine that populates a grid, matrix, or other typeof database structure as needed to prepare the model supervisor module914 for the various calculations, analyses, and functions described inmore detail below. It should be appreciated that subsequent iterationsof the process 1150 (which are performed in an ongoing manner during theclosed-loop mode) need not repeat the initialization of the historicaldata. Rather, task 1156 may simply adjust the data history to reflectnewly received data. For the embodiments described here, the followinghistorical data may be processed by the model supervisor module 914,without limitation: historical insulin-delivered data for the user; andhistorical sensor glucose values for the user. The historicalinsulin-delivered data may correspond to amounts of insulin delivered bythe insulin infusion device during each historical sampling period ofinterest, and the historical sensor glucose values may correspond torespective sensor glucose measurements obtained during each historicalsampling period of interest. In certain implementations, each historicalsensor glucose value may be associated with or derived from a historicalIsig value and a sensor calibration factor.

The process 1150 is iterative in nature, and each iteration considersdata associated with the defined historical period of time (see FIG.54). Accordingly, the process 1150 may define the model training periodand the model prediction period for the historical period of time (task1158). In this regard, task 1158 may identify or designate which datasamples fall within the model training period (the LTH in FIG. 54)and/or which data samples fall within the model prediction period (theLPH in FIG. 54). Task 1158 may also serve to identify or designate“stale” data samples that need not be considered going forward. Inpractice, if data for the oldest sampling period is missing for somereason, then the process 1150 can make appropriate adjustments (e.g.,search for the closest available data sample, wait for the next samplingperiod, or the like).

Next, the process 1150 processes at least some of the historical data todetermine a best-matched solution to a sensor glucose prediction model(task 1160). Task 1160 may be considered to be a training procedure thatfinds the best-fitting sensor glucose prediction function, which in turncan be used to check (predict) the integrity and quality of the glucosesensor. In certain embodiments, the sensor glucose prediction model isexpressed as a fourth order ordinary differential equation that, whensolved given the initial conditions, provides model-predicted sensorglucose values. Notably, task 1160 uses the actual sensor glucose valuesobtained during the model training period (and does not use any of theactual sensor glucose values obtained during the model predictionperiod) to determine which candidate solution will be selected as thebest-matched solution. Conceptually, task 1160 generates a plurality ofcurves (or discrete values that may be used to visualize curves forpurposes of this explanation) and compares the portion of the curveswithin the model training period to the actual sensor glucose valuesobtained during the model training period. In an ideal scenario with aperfect match, one of the generated curves will precisely track theactual sensor glucose values within the model training period. Inpractice, however, the generated curves will deviate from the actualsensor glucose values. Accordingly, task 1160 identifies the calculatedcurve that best matches the actual sensor values. It should beappreciated that this best-matching curve also includes model-predictedsensor glucose values that extend beyond the model training period andinto the model prediction period.

The process 1150 may continue by comparing at least one historicalsensor glucose value obtained during the model prediction period to atleast one corresponding predicted sensor glucose value of thebest-matched solution (task 1162). In certain embodiments, task 1162checks only one actual sensor glucose value: the current sensor glucosevalue obtained for the most recent sampling period. In otherembodiments, any or all of the sensor glucose values obtained during themodel prediction period could be analyzed during task 1162. Thestraightforward example described here only considers the current sensorglucose value such that the comparison in task 1162 is simple andstraightforward. In this regard, task 1162 may calculate a differencebetween the current sensor glucose value (i.e., the most recenthistorical value) and the predicted current glucose value for the mostrecent sampling period (the difference may be expressed as an absolutevalue), and the process 1150 may continue by comparing the calculateddifference to a threshold error amount (query task 1164). In otherembodiments, the comparison performed during task 1162 may involve amore advanced methodology, e.g., curve-fitting that considers more thanone sampling point in the model prediction period, statistical analyses,or the like. For example, rather than calculating error on apoint-by-point basis, the process 1150 could utilize any appropriatemethodology to determine whether or not the historical sensor glucosevalues in the model prediction period deviate (by at least a thresholdamount) from the corresponding model-predicted values in thebest-matched solution.

If the calculated error between the model-predicted glucose value(s) andthe corresponding actual historical sensor glucose value(s) is less thanor equal to the error threshold, or otherwise satisfies thepredetermined criteria monitored by the model supervisor module 914,then the “No” branch of query task 1164 is followed and the process 1150continues to the next sampling period (task 1166). At this point, theprocess 1150 returns to task 1152 such that the core of the process 1150can be repeated to consider the data received for the next samplingperiod. Thus, the oldest data considered by the previous iteration ofthe process 1150 is disregarded, the newly received data is designatedas the “most recent” data, and the historical time period or “analysiswindow” for the current iteration of the process 1150 shifts by onesampling period (see FIG. 54).

If the calculated error exceeds the threshold error amount (the “Yes”branch of query task 1164), then the process 1150 may generate an alert,an alarm, and/or a message (task 1168). In practice, an alert, alarm, ormessage can be initiated by the model supervisor module 914 forrendering, annunciation, delivery, playback, etc. For example, an alertcould be presented at the insulin infusion device, at a remotemonitoring station, at a handheld controller device, or the like. Incertain embodiments, the process 1150 switches from the closed-loop modeto the open-loop mode (or to some type of safe operating mode withreduced insulin delivery) when the threshold error amount is exceeded(task 1170).

One important aspect of the process 1150 relates to the manner in whichthe best-matched sensor glucose prediction model is chosen (see task1160). In this regard, FIG. 56 is a flow chart that illustrates anexemplary embodiment of a sensor model training process 1180, which maybe performed in conjunction with the sensor model supervision process1150 depicted in FIG. 55. The process 1180 is shown and described in asimplified manner for ease of understanding. Certain aspects of theprocess 1180 are addressed in more detail below with reference toparticular implementations of the model supervisor module 914.

As mentioned previously, the exemplary sensor glucose prediction modelutilized here is expressed as a fourth order ordinary differentialequation. In accordance with conventional mathematics, themodel-predicted sensor glucose values (G) in time are calculated as afunction of the two model prediction initial conditions G₀ and dG₀.Here, G₀ is the estimated sensor glucose value for the begin-trainingsampling period 1124 (the start of LTH in FIG. 54), and dG₀ is thederivative of G₀. Therefore, different initial condition values resultin different solutions to the sensor glucose prediction model; eachdistinct set of initial conditions corresponds to a different predictionmodel. For the sake of processing efficiency, the model supervisormodule 914 imposes limits and boundaries on the initial condition valuesto calculate and analyze a manageable number of candidate solutions. Inthis regard, the sensor model training process 1180 may begin bycalculating a range or boundary for each bounded initial condition (task1182).

For the exemplary embodiment presented here, the initial condition dG₀is bounded in a simple manner that is based on a predetermined parameter(which may be adjustable): dG₀=±grad_bound. In contrast, the boundaryfor the initial condition G₀ is based on (or is otherwise influenced by)a baseline historical sensor glucose value obtained during the modeltraining period, such as the sensor glucose value that was obtainedduring the begin-training sampling period 1124. Thus, the process 1180may identify, from the historical sensor glucose values, the baselinesensor glucose value to be used for purposes of calculating the boundaryfor the initial condition G₀: G₀=SG_(k-LTH)±0.14 SG_(k-LTH), whereSG_(k-LTH) is the baseline sensor glucose value obtained for theearliest sampling period in the historical time period under analysis(see FIG. 54). Notably, the boundary for G₀ is a function of thebaseline sensor glucose value, which may vary in an ongoing mannerduring operation of the system, and which may vary from one iteration ofthe process 1180 to another. In practice, if the sensor glucose data ismissing for the begin-training sampling period 1124, then the process1180 can take appropriate measures, e.g., search for the nearestavailable sensor glucose data point, wait for the next sampling period,etc.

The process 1180 may then continue by determining, calculating, orotherwise obtaining the next set of initial conditions (task 1184). Themanner in which the process 1180 selects and steps through the differentinitial conditions is unimportant in this context. The current set ofinitial conditions is used to calculate a candidate solution to thesensor glucose prediction model (task 1186). As mentioned above, eachcandidate solution is calculated as a function of the two boundedinitial conditions. Moreover, each candidate solution is calculated as afunction of estimated plasma insulin for the user, which in turn iscalculated as a function of an amount of insulin delivered to the user.Accordingly, task 1186 may estimate plasma insulin for the user basedon: the current insulin-delivered data (obtained for the most recentsampling period); the historical insulin-delivered data; and an insulinbasal rate for the user. In practice, task 1186 considers the totalinsulin (basal, bolus, and any other insulin delivered) for all samplingperiods. This allows the process 1180 to obtain the candidate solutionto the sensor glucose prediction model based at least in part on theestimated plasma insulin and based at least in part on the baselinesensor glucose value obtained at the earliest sampling period underanalysis.

The process 1180 may continue by generating a training error value,quantity, or function for the candidate solution (task 1188). Thetraining error may be calculated by comparing predicted sensor glucosevalues from the candidate solution to the corresponding historicalsensor glucose values, to obtain a metric that indicates how closely thepredicted values match the actual values. In certain embodiments, thetraining error is based only on predicted values and actual values forthe model training period (LTH in FIG. 54), and, therefore, task 1188does not consider any predicted or actual values for the modelprediction period (LPH in FIG. 54).

If the process 1180 has considered all of the initial conditioncombinations (the “Yes” branch of query task 1190), then the process1180 may proceed to a task 1192. If more sets of initial conditionsremain (the “No” branch of query task 1190), then the process 1180 mayreturn to task 1184, retrieve the next set of initial conditions, andcontinue as described above. Task 1192 is performed after a plurality ofdifferent candidate solutions have been calculated, using the differentsets of initial conditions. Task 1192 may be performed to select thebest-matching candidate solution from the plurality of calculatedsolutions. For this particular embodiment, the selection is based on thetraining errors generated during task 1188. For example, the candidatesolution having the lowest training error may be selected as thebest-matching solution.

It should be appreciated that the process 1180 need not be performed inthe illustrated sequence, and that some tasks could be performed inparallel. For example, the calculation of the training errors (task1188) may instead be performed after all of the candidate solutions havebeen obtained and saved. Moreover, the process 1180 could be designed toimmediately eliminate candidate solutions (following completion of task1188) that have a training error that exceeds a predetermined errorthreshold. As another option, the process 1180 could be designed toimmediately designate a candidate solution as the best-matched solutionif the associated training error satisfies certain criteria.

The foregoing concepts and methodologies may be implemented in apractical embodiment of the model supervisor module 914. The followingdescription relates to two possible embodiments that implement thegeneral concepts presented above. It should be appreciated that theparticular embodiments described below are not exhaustive, and that thedescription of the embodiments is not intended to limit or restrict thescope or application of the subject matter presented here.

Model Supervisor Module: First Representation

The model supervisor module 914 is suitably designed and configured todetect potentially faulty sensor measurements. The model supervisormodule 914 may utilize a mathematical model that is trained offline. Forexample, parameters that could be estimated offline estimated include,without limitation: K_(I) (insulin gain in mg/dL per U/h; τ₁ (firstinsulin time constant, in minutes); τ₂ (second insulin time constant, inminutes); Ibasal (basal insulin, in U/h); and SGbase (blood glucose (BG)at fasting, in mg/dL, when Ibasal insulin is delivered.

The model supervisor module 914 trains the model prediction initialconditions, G₀ and dG₀ every sampling time. G₀ and dG₀ represent the BG(mg/dL) and BG derivative (mg/dL/min) estimate values at k-LTH (see FIG.54), where LTH is the length of the training data (sampling times) and kis equal to the present sampling time minus LPH. In this context, LPH isthe length of the prediction horizon in sampling times. G₀ and dG₀estimations are bounded as formulated by the expressions collectivelyidentified below as Equation 77. Note that these initial conditions andtheir boundaries were also described above with reference to task 1182of the sensor model training process 1180.G ₀ =CGM _(k-LTH)±0.14·CGM _(k-LTH)dG ₀=±grad_bound  (eq 77)For Equation 77, CGM_(k-LTH) is the CGM measurement at sampling timek-LTH, and grad_bound is a predefined absolute maximum BG derivative intime (mg/dL/min).

The model supervisor module 914 estimates plasma insulin, I_(p), atk-LTH using the insulin history records from k-LTH-insulin history andk-LTH (see FIG. 54) in accordance with Equation 81. Having the estimatedI_(p), G₀, and dG₀, a model prediction is generated frompresent-LTH-LPH, until present (as described above for task 1186 of thesensor model training process 1180). The model prediction enables thecalculation of two values: Terr and Perr. Terr is defined as the meansum square of errors between the model prediction and the CGM recordsfrom k-LTH and k (Equation 78). Perr is defined as the absolute meanerror between the model prediction and the CGM records from k andpresent (Equation 79). Note that Terr is one type of training error,which was described above for task 1188 of the process 1180, and Perr isone type of prediction error, as described above for task 1162 and querytask 1164 of the sensor model supervision process 1150. A fault isdefined when Perr<err1 and Terr>err2 (Equation 80).

$\begin{matrix}{{Terr} = \sqrt{\frac{\sum\limits_{i = {k - {LTH}}}^{k}\;( {{Model}_{i} - {CGM}_{i}} )^{2}}{LTH}}} & ( {{eq}\mspace{14mu} 78} ) \\{{Perr} = {{abs}( \frac{{\sum\limits_{i = k}^{k + {LPH}}\;{Model}_{i}} - {CGM}_{i}}{LPH} )}} & ( {{eq}\mspace{14mu} 79} ) \\{{Fault} = \{ \begin{matrix}{1,} & {{{if}\mspace{14mu}{Terr}} < {{err}\; 1\mspace{14mu}{and}\mspace{14mu}{Perr}} > {{err}\; 2}} \\{0,} & {{{else}\mspace{14mu}{if}\mspace{14mu}{Terr}} \leq {{err}\; 2\mspace{14mu}{or}\mspace{14mu}{Perr}} \geq {{err}\; 1}} \\{{- 1},} & {{if}\mspace{14mu}{not}\mspace{14mu}{enough}\mspace{14mu}{data}\mspace{14mu}{records}\mspace{14mu}{available}}\end{matrix} } & ( {{eq}\mspace{14mu} 80} )\end{matrix}$In Equation 80, Fault 1 indicates a faulty sensor, Fault 0 indicates anon-faulty sensor, and Fault −1 indicates that there is not enoughinformation to decide. Referring again to FIG. 55, Fault 1 correspondsto the “Yes” branch of query task 1164.

In certain embodiments, some of the parameters used by the modelsupervisor module 914 may be adjustable. Table 5 identifies theadjustable parameters, along with some exemplary values for theparameters.

TABLE 5 Adjustable Parameters For the Model Supervisor Module TypicalStarting Minimum Maximum Parameter Symbol Value Value Value Insulin gainK₁ −100 −500 −1 Insulin time τ₁ 30 0.1 150 constant Insulin time τ₂ 1500.1 150 constant Fasting BG SGbase 120 50 300 Basal insulin at Ibasal 10.1 3 fasting BG Training data err1 5 1 100 error Prediction data err220 1 100 error Length of LTH 8 5 30 training data Length of LPH 3 1 20prediction data Length of insulin Insulin History 48 30 60 data BGmaximum grad_bound 5 1 8 absolute derivative

The following equations describe the mathematical model equations inLaplace transform form:

$\begin{matrix}{{{\hat{I}}_{p}(s)} = {\frac{1}{( {{50s} + 1} )( {{70s} + 1} )}( {{\hat{I}}_{D} + {{\hat{I}}_{P\; 0}s\;\alpha\;\alpha} + {{dI}_{P\; 0}\beta}} )}} & ( {{eq}\mspace{14mu} 81} )\end{matrix}$

In this expression, α=3500, β=120, and Î_(P) is the I_(P) in deviationform. Î_(P0) and dI_(P0) are the Î_(P) and derivative initialconditions, respectively.

All the insulin states are formulated in deviation form from the giveninsulin value Ibasal as it is expressed by the following Equation 82:Î _(x) =I _(x) −Ibasal  (eq 82)In Equation 82, x represents D, in, or P.

The following Equation 83 expresses BG in deviation form from SGbase.Note that Equation 83 represents one suitable expression for the sensorglucose prediction model, which is a fourth order ordinary differentialequation.

$\begin{matrix}{{\hat{G}(s)} = {\frac{1}{( {{\tau_{1}s} + 1} ) \cdot ( {{\tau_{2}s} + 1} )}( {{K_{I} \cdot {\hat{I}}_{P}} - {\frac{1}{( {{50s} + 1} )( {{70s} + 1} )}( {{{\hat{G}}_{0} \cdot \alpha} + {( {{\hat{G}}_{0}{{\cdot s} + {d{\hat{G}}_{0}}}} ) \cdot \beta} + {( {{{\hat{G}}_{0} \cdot s^{2}} + {d{{\hat{G}}_{0} \cdot s}}} ) \cdot \chi} + {( {{{\hat{G}}_{0} \cdot s^{3}} + {d{{\hat{G}}_{0} \cdot s^{2}}}} ) \cdot \delta}} )}} )}} & ( {{eq}\mspace{14mu} 83} )\end{matrix}$In Equation 83, the following relationships hold:

α=120+τ₁+τ₂

β=3500+120 τ₁+120τ₂+τ₁τ₂

χ=3500τ₁+3500τ₂+120τ₁τ₂

δ=3500τ₁τ₂

Moreover, in Equation 78, Ĝ, K_(I), Ĝ₀, dG₀, τ₁, and τ₂ are the BG indeviation form from SGbase, the insulin gain, the BG initial conditionsin deviation form, the BG derivative initial conditions, and two timeconstants, respectively.

Model Supervisor Module: Second Representation

In accordance with some embodiments, the functionality of the modelsupervisor module 914 can be represented as follows. As mentioned above,the model supervisor module 914 estimates the user's glucoseconcentration in real-time based on the insulin delivered, the sensorIsig values, and sensor calibration factors. If the model-predictedsensor glucose value (SG) and the actual SG value differ significantly,the system will trigger a fail-safe alert that indicates that thecollected data contains unexplained behavior, which may in turn beassociated with a faulty sensor and/or insulin delivery, or anunannounced meal intake.

The time frames and reference time periods for the model supervisormodule 914 are defined as shown in FIG. 54. The methodology performed bythe model supervisor module 914 uses data packets received for past timeframes to estimate plasma insulin and model-predicted glucose in orderto estimate the fault conditions. The sampling time is the time intervalbetween two consecutive data packets, which for this particular exampleis five minutes. The insulin history in FIG. 54 corresponds to a definedpast time frame that is needed to estimate plasma insulin (for thisexample, the insulin history corresponds to four hours or 48 samplingperiods). The length training horizon (LTH) for this example includes 24data packets, which corresponds to a past time frame of 120 minutes. Thelength of predicted horizon (LPH) for this example includes 24 datapackets, which corresponds to a past time frame of 120 minutes. In FIG.54, k is equal to the present number of data packets minus LPH, and“present” indicates the most recent sampling time.

The following equations describe the mathematical model in Laplacetransform form. Equation 84 provides an estimate of the plasma insulin,and Equation 85 provides the model-predicted SG values. Accordingly, themodel supervisor module 914 in accordance with this particularembodiment estimates the plasma insulin as follows:

$\begin{matrix}{{{\hat{I}}_{p}(s)} = {\frac{1}{( {{50s} + 1} )( {{70s} + 1} )}( {{\hat{I}}_{D} + {{\hat{I}}_{P\; 0}{sɛ}} + {{dI}_{P\; 0}\gamma}} )}} & ( {{eq}\mspace{14mu} 84} )\end{matrix}$For this example, ε=3500, γ=120, Î_(P) is the estimated plasma insulinin deviation form, (s) refers to Laplace transform form, and Î_(D) isthe insulin delivered from the system in deviation form. Moreover,Î_(P0) is the estimated plasma insulin in deviation form for thesampling time identified as k-LTH (see FIG. 54), dI_(P0) is thederivative of the estimated plasma insulin, and α and β are constants.

The insulin states described above are formulated in deviation form froma given insulin value Ibasal as it is expressed by the followingequation:Î _(x) =I _(x) −Ibasal  (eq 85)In Equation 85, x represents D or P (where D refers to insulin deliveredand P refers to plasma insulin), and I_(basal,0) is the estimated basalrate defined for each user to bring the patient to a fasting bloodglucose (FBG) of the value FBG₀ (in mg/dL).

For this second embodiment, the model-predicted sensor glucose value, Ĝ,in time is calculated in accordance with Equation 83 and the associatedrelationships, as described for the first embodiment of the modelsupervisor module 914. In this regard, Ĝ is the model-predicted SG valuein deviation form from FBG₀ (estimated blood glucose using meter bloodglucose readings at the end of the night period), (s) refers to Laplacetransform form, τ₁, and τ are the two insulin time constants identifiedfor each patient, which are related to how fast a patient reacts toinsulin, K_(I) is the insulin gain, and Î_(P) is the estimated plasmainsulin in deviation form. Moreover, Ĝ₀ is the estimated SG value (inmg/dL) in deviation form for the sampling time of k-LTH (see FIG. 54),as calculated in accordance with Equation 86 below, and dG₀ (calculatedby Equation 87 below) is the derivative of the estimated SG value (inmg/dL/min) for the sampling time of k-LTH. The constants α, β, χ, and δare calculated as set forth above in the context of Equation 83.

The estimated blood glucose values are calculated as a function of themodel prediction initial conditions, G₀ and dG₀. For this particularembodiment, the estimations for G₀ and dG₀ are bounded as formulated bythe following equations. Note that these initial conditions and theirboundaries were also described above with reference to task 1182 of thesensor model training process 1180.G ₀=SG_(k-LTH)±0.14·SG_(k-LTH)  (eq 86)dG ₀=±grad_bound  (eq 87)Here, G₀ is the estimated SG value (in mg/dL) value for the samplingtime of k-LTH, SG_(k-LTH) is the SG measurement for the sampling time ofk-LTH, dG₀ is the derivative of the estimated SG value (in mg/dL/min)for the sampling time of k-LTH, and grad_bound is a predefined absolutemaximum SG derivative in time (mg/dL/min). For certain embodiments,grad_bound is a fixed parameter. For the example presented here,grad_bound has a value of 5 mg/dL/min.

The model prediction facilitates the calculation of two values: Terr andPerr. Terr is defined as the mean absolute error between the modelpredicted SG values and the actual SG records for the sampling timeidentified as k-LTH and k as calculated by Equation 88 below. Perr isdefined as the mean absolute error between the model predicted SG valuesand the actual SG records for sampling times identified as k to present(see FIG. 54) as calculated by Equation 89 below.

$\begin{matrix}{{Terr} = \frac{\sum\limits_{i = {k - {LTH}}}^{k}\;{{abs}( {{Model}_{i} - {SG}_{i}} )}}{LTH}} & ( {{eq}\mspace{14mu} 88} )\end{matrix}$Here, Terr is defined as the mean absolute error between the modelpredicted SG values (Model_(i)) and the SG records (SG_(i)) for thesampling time identified as k-LTH and k.

$\begin{matrix}{{Perr} = {{\frac{{abs}( {{Model}_{present} - {SG}_{present}} )}{{SG}_{present}} \cdot 100}\%}} & ( {{eq}\mspace{14mu} 89} )\end{matrix}$Here, Perr is defined as the percentage of error between the modelprediction and the SG measurement at the present (most recent) samplingtime.

In accordance with this particular implementation, the model supervisormodule 914 estimates the fault scenario based on Equation 90, whereFault 1 signifies a faulty sensor, Fault 0 indicates a non-faultysensor, Fault 3 indicates a training error, and Fault −1 indicates thatthere is not enough data available to make a determination.

$\begin{matrix}{{Fault} = \{ \begin{matrix}{1,} & {{{if}\mspace{14mu}{Terr}} < {{err}\; 1\mspace{14mu}{and}\mspace{14mu}{Perr}} > {{err}\; 2}} \\{0,} & {{{if}\mspace{14mu}{Perr}} \leq {{err}\; 2\mspace{14mu}{or}\mspace{14mu}{Terr}} \geq {{err}\; 1}} \\{3,} & {{{if}\mspace{14mu}{Terr}} > {{err}\; 3}} \\{{- 1},} & {{if}\mspace{14mu}{not}\mspace{14mu}{enough}\mspace{14mu}{data}\mspace{14mu}{available}}\end{matrix} } & ( {{eq}\mspace{14mu} 90} )\end{matrix}$In Equation 90, err1 is the upper threshold for the mean absolute error(see Equation 88). Thus, if the training error is above this threshold,a fault cannot be triggered because the credibility of the training issuspect. The err2 is the lower threshold for Equation 89. If theprediction value of the model and the sensor measurement at present areabove this threshold and the training error is less than err1, then afault will be triggered. The err3 defines a lower threshold for thetraining period. If Equation 88 indicates a value that is above thisthreshold, then a warning associated with poor training can betriggered.

FIG. 57 is a diagram that illustrates exemplary sensor conditionscorresponding to a non-faulty sensor (Fault 0) and a faulty sensor(Fault 1). The common horizontal axis indicates the present samplingtime at the far right, along with the time periods identified by LPH andLTH. The sampling time 1202 corresponds to the oldest data considered bythe model supervisor module 914 at the present time. Accordingly,historical data 1204 for sampling times that occurred before thesampling time 1202 is disregarded.

The top plot 1206 in FIG. 57 is indicative of a non-faulty sensor (Fault0), the middle plot 1208 is indicative of a faulty sensor (Fault 1), andthe bottom plot 1210 depicts the insulin administered, which is neededin order to estimate the plasma insulin and to generate the modelpredicted SG values. In the plots 1206, 1208, the solid line 1212represents the model-predicted SG values, and the dots represent theactual SG measurements. The dashed vertical line 1214 represents thedemarcation between the LTH time frame and the LPH time frame. The linesbetween the solid line 1212 and the dots represent the difference(error) between the model-predicted SG values and the actual SGmeasurements. Dashed lines are utilized in the LPH time frame, whichcorresponds to fifteen minutes or three sampling periods for thisexample.

Referring to the top plot 1206, there is good agreement between themodel predicted SG values (represented by the solid line 1212) and theactual SG measurements (represented by the dots). In other words, theactual measurements do not deviate significantly from the predictedvalues. In certain embodiments, the model supervisor module 914 onlycompares actual measurement values that are within the LPH time frame.In accordance with one exemplary embodiment, the model supervisor module914 determines the fault status based solely on the most recentlyobtained data, i.e., the information received for the last samplingtime. For this example depicted in FIG. 55, Perr is less than or equalto err2. Thus, in accordance with Equation 90, the model supervisormodule 914 returns Fault 1 and the system is commanded to remain in theclosed-loop mode.

Referring to the middle plot 1208, of FIG. 57, there is good agreementbetween the model predicted SG values and the actual SG measurements inthe LTH time period (for this period, Terr is less than err1 in Equation90). Note, however, that there is a significant difference observedbetween the model predicted SG last value and the actual last SGmeasurement 1218 (Perr is greater than err2 in Equation 90). In thisscenario, therefore, the model supervisor module 914 will issue afail-safe alert and/or take other appropriate measures.

In certain embodiments, some of the parameters used by the modelsupervisor module 914 may be adjustable. Table 6 identifies someadjustable parameters for this embodiment, along with some exemplaryvalues for the parameters.

TABLE 6 Adjustable Parameters For the Model Supervisor Module ParameterDefault Value Lower Bound Upper Bound K_(I) (mg/dL/U/H) −100 −360 −49FBG₀ (mg/dL) 120 50 300 Ibasal (U/H) 1 0.1 3 err1 (mg/dL) 5 1 30 err2(%) 50 20 100 err3 (mg/dL) 10 1 30 LTH (sampling times) 24 4 48 LPH(sampling times) 24 1 48

Missed Transmission Module

The missed transmission module 916 continuously checks whether thecontroller receiving data packets (including SG values) for processing.The missed transmission module 916 keeps the system operating in theclosed-loop mode for when less than a stated number of data packets aremissed (e.g., less than four data packets in a row, a total number ofdata packets that represent a timespan of less than 15 minutes, or thelike). During this time, the system will continue to calculate theinsulin dose using the closed-loop control algorithm based on the lastvalid sensor glucose value or sensor Isig value. For missed data packetsthat represent a time longer than a lower time threshold and longer thanan upper time threshold (e.g., between 15 and 60 minutes), the missedtransmission module 916 switches the system to a pre-programmed safebasal rate, which may be defined as half the patient's nighttime basalrate. If the controller starts receiving data packets during the safebasal rate timeframe, the system will switch back to the closed-loopmode. For missed data packets that represent a time longer than theupper time threshold, however, the missed transmission module 916switches the system to the open-loop mode to deliver a pre-programmednighttime basal rate, which may be set by a healthcare provider or acaregiver.

The missed transmission module 916 checks for different scenariospertaining to when and what kind of packet is lost during transmission.Different steps are executed depending on the type of lost transmission.The details of four different scenarios are described below.

Case 1

If the sensor Isig value and the SG value are both received by thecontroller, then:

(a) the sensor Isig is saved by the controller;

(b) the SG value is saved by the controller;

(c) a Zero Order Hold (ZOH) count is set to zero; and

(d) the system remains in the closed-loop mode as described previously.

Case 2

If the sensor Isig value is not received, but the SG value is receivedby the controller, then:

(a) the ZOH count is set to zero;

(b) Isig is calculated by Equation 91 (see below) using the SG value andthe sensor calibration factor; and

(c) the system remains in the closed-loop mode.Isig_(calc)=(SG/CF′)+2  (eq 91)

Case 3

If the sensor Isig value is received, but the SG value is not receivedby the controller, then:

(a) the ZOH count is set to zero;

(b) SG is calculated by Equation 92 (see below) using the Isig value andthe sensor calibration factor; and

(c) the system remains in the closed-loop mode.SG_(calc)=(Isig−2)×CF′  (eq 92)

Case 4a

If neither the sensor Isig value nor the SG value are received by thecontroller (i.e., both values are not received), and if:ZOH Count≤ZOH Count Maxthen:

(a) the ZOH count for the sensor Isig and SG is calculated based onprevious values;

(b) ZOH Count=ZOH Count+1;

(c) TimeoutCount=0; and

(d) the system remains in the closed-loop mode.

Case 4b

If neither the sensor Isig value nor the SG value are received by thecontroller (i.e., both values are not received), and if:ZOH Count≥ZOH Count Maxthen:

(a) an “invalid” place holder for the sensor Isig and SG value is saved;

(b) the system remains in the closed-loop mode, but switches to atemporary safe basal rate, which is half the patient's night time basalrate when in the open-loop mode;

(c) if a packet is received by the system while it is delivering thesafe basal rate, the system will transition back to the closed-loopmode;

(d) for every minute that the system is delivering the safe basal rate,a TimeoutCount is incremented: TimeoutCount=TimeoutCount+1;

(e) if TimeoutCount>Timeout Count Max, then the system switches to theopen-loop mode.

In accordance with certain embodiments, ZOH Count Max has a fixed valueof two, and Timeout Count Max has a fixed value of 45, althoughdifferent values may be used as appropriate to the particularimplementation. Moreover, the safe basal rate used by the missedtransmission module 916 may be adjustable. In this regard, the safebasal rate may be adjustable within a range of about zero to fiveUnits/Hour.

While at least one exemplary embodiment has been presented in theforegoing detailed description, it should be appreciated that a vastnumber of variations exist. It should also be appreciated that theexemplary embodiment or embodiments described herein are not intended tolimit the scope, applicability, or configuration of the claimed subjectmatter in any way. Rather, the foregoing detailed description willprovide those skilled in the art with a convenient road map forimplementing the described embodiment or embodiments. It should beunderstood that various changes can be made in the function andarrangement of elements without departing from the scope defined by theclaims, which includes known equivalents and foreseeable equivalents atthe time of filing this patent application.

What is claimed is:
 1. A processor-implemented method of controlling aninsulin infusion device for a user, the insulin infusion devicecomprising an insulin reservoir for insulin to be delivered from theinsulin infusion device to a body of the user, and further comprising aprocessor architecture having at least one processor device, the methodcomprising: operating the insulin infusion device in a closed-loop modeto deliver insulin from the insulin reservoir to the body of the user;operating the processor architecture to obtain current insulin-delivereddata that indicates an amount of insulin delivered by the insulininfusion device during a most recent sampling period; operating theprocessor architecture to obtain current sensor data that indicates acurrent sensor glucose value for the user corresponding to the mostrecent sampling period; processing historical insulin-delivered data andhistorical sensor data, for a plurality of historical sampling periodsprior to the most recent sampling period, to obtain predicted sensorglucose values for a historical time period, the historical time periodincluding the most recent sampling period, and the predicted sensorglucose values comprising a predicted current sensor glucose value forthe most recent sampling period; calculating a difference between thecurrent sensor glucose value and the predicted current sensor glucosevalue for the most recent sampling period; generating an alert when thedifference exceeds a threshold error amount; and operating the processorarchitecture to switch the insulin infusion device from the closed-loopmode to an open-loop mode in response to generating the alert.
 2. Themethod of claim 1, wherein: a recent history period corresponds to aperiod of time from a begin-prediction sampling period to the mostrecent sampling period, inclusive; a distant history period correspondsto a period of time from a begin-training sampling period to anend-training sampling period, inclusive; the distant history periodoccurred before the recent history period; and the processing obtainsthe predicted sensor glucose values as a function of a bounded initialcondition that is influenced by a baseline sensor glucose value obtainedduring the distant history period.
 3. The method of claim 2, wherein thebegin-prediction sampling period corresponds to the end-trainingsampling period.
 4. The method of claim 2, wherein the baseline sensorglucose value is obtained during the begin-training sampling period. 5.The method of claim 1, wherein the processing comprises: estimatingplasma insulin for the user based on the current insulin-delivered data,the historical insulin-delivered data, and an insulin basal rate for theuser; and obtaining the predicted sensor glucose values based at leastin part on the estimated plasma insulin.
 6. The method of claim 1,wherein the processing comprises: calculating a plurality of candidatesolutions to a sensor glucose prediction model, wherein each of theplurality of candidate solutions is calculated as a function of abounded initial condition, and wherein the bounded initial condition isinfluenced by a baseline sensor glucose value, wherein the historicalsensor data includes the baseline sensor glucose value; and selectingone of the calculated plurality of candidate solutions for use as thepredicted sensor glucose values.
 7. A processor-implemented method ofcontrolling an insulin infusion device for a user, the insulin infusiondevice comprising an insulin reservoir for insulin to be delivered fromthe insulin infusion device to a body of the user, and furthercomprising a processor architecture having at least one processordevice, the method comprising: operating the insulin infusion device ina closed-loop mode to deliver insulin from the insulin reservoir to thebody of the user; operating the processor architecture to identify, fromhistorical sensor glucose values for the user, a baseline historicalsensor glucose value obtained during a begin-training sampling period;operating the processor architecture to calculate a plurality ofcandidate solutions to a sensor glucose prediction model, wherein eachof the plurality of candidate solutions is calculated as a function of abounded initial condition and historical insulin-delivered data for theuser, and wherein the bounded initial condition is influenced by thebaseline sensor glucose value; operating the processor architecture toselect one of the calculated plurality of candidate solutions, based ona comparison of predicted sensor glucose values from the calculatedplurality of candidate solutions to a first portion of the historicalsensor glucose values, resulting in a selected solution; operating theprocessor architecture to compare at least one predicted sensor glucosevalue from the selected solution to a second portion of the historicalsensor glucose values, wherein the first portion of the historicalsensor glucose values corresponds to a distant history period, thesecond portion of the historical sensor glucose values corresponds to arecent history period, and the distant history period occurred beforethe recent history period that data samples; generating an alert, inresponse to the comparing, when the second portion of the historicalsensor glucose values deviates from the selected solution by at least athreshold error amount; and operating the processor architecture toswitch the insulin infusion device from the closed-loop mode to anopen-loop mode in response to generating the alert.
 8. The method ofclaim 7, wherein the calculating comprises: estimating plasma insulinfor the user based on at least some of the historical insulin-delivereddata for the user, and based on an insulin basal rate for the user,wherein each of the plurality of candidate solutions is calculated basedat least in part on the estimated plasma insulin.
 9. Aprocessor-implemented method of controlling an insulin infusion devicefor a user, the insulin infusion device comprising an insulin reservoirfor insulin to be delivered from the insulin infusion device to a bodyof the user, and further comprising a processor architecture having atleast one processor device, the method comprising: operating the insulininfusion device in a closed-loop mode to deliver insulin from theinsulin reservoir to the body of the user; defining a model trainingperiod and a model prediction period for a historical period of time;operating the processor architecture to find a solution to a sensorglucose prediction model, relative to historical sensor glucose valuesobtained during the model training period, wherein the solution found isa function of a baseline sensor glucose value obtained during the modeltraining period, and is a function of historical insulin-delivered datafor the user obtained during the historical period of time; operatingthe processor architecture to compare at least one predicted sensorglucose value from the solution found to at least one historical sensorglucose value corresponding only to the model prediction period;generating an alert, in response to the comparing, when the at least onehistorical sensor glucose value deviates from the at least one predictedsensor glucose value by at least a threshold error amount; and operatingthe processor architecture to switch the insulin infusion device fromthe closed-loop mode to an open-loop mode in response to generating thealert.
 10. The method of claim 9, wherein the comparing compares a mostrecent historical sensor glucose value to a most recent predicted sensorglucose value from the solution found.
 11. The method of claim 9,wherein the model prediction period immediately follows the modeltraining period.
 12. The method of claim 9, wherein finding the solutioncomprises: calculating a plurality of candidate solutions to the sensorglucose prediction model; comparing predicted sensor glucose values fromthe calculated plurality of candidate solutions to correspondinghistorical sensor glucose values obtained only during the model trainingperiod, to obtain a respective training error for each of the calculatedplurality of candidate solutions; and selecting the solution from thecalculated plurality of candidate solutions, based on the trainingerror.